这个是ant 配置文件,大家根据变量将自己的路径修改后测试;
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:spring-boot="antlib:org.springframework.boot.ant"
name="WebBroker" default="make-war" basedir="..">
<!-- property -->
<property name="target" value="1.8"/>
<property name="source" value="1.8"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="dir.src" value="${basedir}/src/main/java"/>
<property name="dir.res" value="${basedir}/src/main/resources"/>
<property name="dir.web" value="${basedir}/src/main/webapp"/>
<property name="dir.classes" value="${basedir}/target/classes"/>
<property name="dir.lib1" value="../RM_lib/common_lib"/>
<property name="dir.lib2" value="../RM_lib/WebBroker_lib"/>
<!-- 配置文件【所有配置文件必须按相应的目录结构存放到build/CONFIG目录下】 -->
<property name="build.config.dir" value="${basedir}/build/CONFIG"/>
<!-- 构建结果存放的目录 -->
<property name="deploy.home" value="../DEPLOY"/>
<property name="deploy.war.name" value="${deploy.home}/MRMS.war"/>
<!-- 构建路径 -->
<path id="compile.classpath">
<pathelement location="${dir.classes}" />
<fileset dir="${dir.lib1}" includes="**.jar" />
<fileset dir="${dir.lib2}" includes="**.jar" />
</path>
<!-- 初始化 -->
<target name="init">
<!-- 【首先替换配置文件】 -->
<copy todir="${basedir}" overwrite="true" preservelastmodified="true">
<fileset dir="${build.config.dir}" includes="**/**" />
</copy>
<!-- clean & mkdir -->
<mkdir dir="${deploy.home}"/>
<delete dir="${dir.classes}"/>
<mkdir dir="${dir.classes}"/>
</target>
<!-- 编译 -->
<target name="compile" depends="init">
<javac destdir="${dir.classes}" encoding="UTF-8" debug="false" debuglevel="${debuglevel}" includeantruntime="on"
source="${source}" target="${target}" deprecation="false" fork="false" failοnerrοr="false">
<src path="${dir.src}"/>
<src path="${dir.res}"/>
<classpath refid="compile.classpath"/>
<compilerarg value="-Xlint:unchecked" />
</javac>
<copy includeemptydirs="false" todir="${dir.classes}" preservelastmodified="true">
<fileset dir="${dir.src}" excludes="**/**.java"/>
<fileset dir="${dir.res}" excludes="**/**.java"/>
</copy>
</target>
<!-- 打war包 -->
<target name="make-war" depends="compile">
<war destfile="${deploy.war.name}" compress="false" webxml="${dir.web}/WEB-INF/web.xml">
<mappedresources>
<fileset dir="${dir.classes}" />
<globmapper from="*" to="WEB-INF/classes/*"/>
</mappedresources>
<mappedresources>
<fileset dir="${dir.web}/VAADIN" />
<globmapper from="*" to="VAADIN/*"/>
</mappedresources>
<zipfileset src="${dir.lib1}/spring-boot-loader-1.5.9.RELEASE.jar" />
<lib dir="${dir.lib1}" excludes="spring-boot-loader-1.5.9.RELEASE.jar" />
<lib dir="${dir.lib2}"/>
<manifest>
<attribute name="Main-Class" value="org.springframework.boot.loader.JarLauncher" />
<attribute name="Start-Class" value="com.rquest.riskmaster.RotterdamApplication" />
</manifest>
</war>
</target>
<target name="RotterdamApplication">
<java classname="com.rquest.riskmaster.RotterdamApplication" failοnerrοr="true" fork="yes">
<classpath refid="compile.classpath"/>
</java>
</target>
</project>