65.1 Spring Boot Ant tasks
Once the spring-boot-antlib namespace has been declared, the following additional tasks are available.
65.1.1 spring-boot:exejar
The exejar task can be used to creates a Spring Boot executable jar. The following attributes are supported by the task:
| Attribute | Description | Required |
|---|---|---|
destfile |
The destination jar file to create | Yes |
classes |
The root directory of Java class files | Yes |
start-class |
The main application class to run | No (default is first class found declaring a main method) |
The following nested elements can be used with the task:
| Element | Description |
|---|---|
resources |
One or more Resource Collections describing a set of Resources that should be added to the content of the created jar file. |
lib |
One or more Resource Collections that should be added to the set of jar libraries that make up the runtime dependency classpath of the application. |
65.1.2 Examples
Specify start-class.
<spring-boot:exejar destfile="target/my-application.jar"
classes="target/classes" start-class="com.foo.MyApplication">
<resources>
<fileset dir="src/main/resources" />
</resources>
<lib>
<fileset dir="lib" />
</lib>
</spring-boot:exejar>
Detect start-class.
<exejar destfile="target/my-application.jar" classes="target/classes">
<lib>
<fileset dir="lib" />
</lib>
</exejar>