You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.7 KiB
75 lines
2.7 KiB
<project |
|
xmlns:ivy="antlib:org.apache.ivy.ant" |
|
xmlns:spring-boot="antlib:org.springframework.boot.ant" |
|
name="spring-boot-smoke-test-ant" |
|
default="build"> |
|
|
|
<description> |
|
Sample ANT build script for a Spring Boot executable JAR project. Uses ivy for |
|
dependency management and spring-boot-antlib for additional tasks. Run with |
|
'$ ant -lib ivy-2.2.jar spring-boot-antlib.jar' (substitute the location of your |
|
actual jars). Run with '$ java -jar target/*.jar'. |
|
</description> |
|
|
|
<property name="lib.dir" location="${basedir}/lib" /> |
|
<property name="start-class" value="smoketest.ant.SampleAntApplication" /> |
|
|
|
<target name="clean-ivy-cache"> |
|
<ivy:cleancache /> |
|
</target> |
|
|
|
<target name="resolve" depends="clean-ivy-cache" description="--> retrieve dependencies with ivy"> |
|
<ivy:retrieve pattern="${lib.dir}/[conf]/[artifact]-[type]-[revision].[ext]" /> |
|
</target> |
|
|
|
<target name="classpaths" depends="resolve"> |
|
<path id="compile.classpath"> |
|
<fileset dir="${lib.dir}/compile" includes="*.jar" /> |
|
</path> |
|
</target> |
|
|
|
<target name="init" depends="classpaths"> |
|
<mkdir dir="${basedir}/classes" /> |
|
</target> |
|
|
|
<target name="compile" depends="init" description="compile"> |
|
<javac srcdir="${projectDir}/src/main/java" destdir="${basedir}/classes" classpathref="compile.classpath" fork="true" includeantruntime="false" source="8" target="8" compiler="javac1.8"/> |
|
</target> |
|
|
|
<target name="clean" description="cleans all created files/dirs"> |
|
<delete dir="target" /> |
|
<delete dir="${lib.dir}" /> |
|
</target> |
|
|
|
<target name="build" depends="compile"> |
|
<delete file="${basedir}/libs/${ant.project.name}.jar"/> |
|
<spring-boot:exejar destfile="${basedir}/libs/${ant.project.name}.jar" classes="${basedir}/classes"> |
|
<spring-boot:lib> |
|
<fileset dir="${lib.dir}/runtime" /> |
|
</spring-boot:lib> |
|
</spring-boot:exejar> |
|
</target> |
|
|
|
<!-- Manual equivalent of the build target --> |
|
<target name="manual" depends="compile"> |
|
<jar destfile="target/${ant.project.name}-${ant-spring-boot.version}.jar" compress="false"> |
|
<mappedresources> |
|
<fileset dir="${basedir}/classes" /> |
|
<globmapper from="*" to="BOOT-INF/classes/*"/> |
|
</mappedresources> |
|
<mappedresources> |
|
<fileset dir="src/main/resources" erroronmissingdir="false"/> |
|
<globmapper from="*" to="BOOT-INF/classes/*"/> |
|
</mappedresources> |
|
<mappedresources> |
|
<fileset dir="${lib.dir}/runtime" /> |
|
<globmapper from="*" to="BOOT-INF/lib/*"/> |
|
</mappedresources> |
|
<zipfileset src="${lib.dir}/loader/spring-boot-loader-jar-${ant-spring-boot.version}.jar" /> |
|
<manifest> |
|
<attribute name="Main-Class" value="org.springframework.boot.loader.launch.JarLauncher" /> |
|
<attribute name="Start-Class" value="${start-class}" /> |
|
</manifest> |
|
</jar> |
|
</target> |
|
</project>
|
|
|