IDEA社区版,真香!
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply create one in the same
directory with the processing instruction <??>
as the first entry and export the buildfile again. -->
<project basedir="." default="packWar" name="项目名称">
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.8"/>
<property name="source" value="1.8"/>
<!--自定义部分-->
<property name="build" value="${basedir}/build"/>
<property name="" value="${basedir}/build/classes"/>
<property name="src" value="${basedir}/src"/>
<property name="web" value="${basedir}/WebContent"/>
<property name="project_jar_path" value="${web}/WEB-INF/lib"/>
<property name="jre_jar_path" value="JDK路径\jre\lib"/>
<property name="jre_jar_ext_path" value="JDK路径\jre\lib\ext"/>
<property name="tomcat_jar_path" value="Tomcat路径\lib"/>
<path id="project_jar">
<fileset dir="${project_jar_path}">
<include name="*.jar"/>
</fileset>
</path>
<path id="jre_jar">
<fileset dir="${jre_jar_path}">
<include name="*.jar"/>
</fileset>
</path>
<path id="jre_ext_jar">
<fileset dir="${jre_jar_ext_path}">
<include name="*.jar"/>
</fileset>
</path>
<path id="tomcat_jar">
<fileset dir="${tomcat_jar_path}">
<include name="*.jar"/>
</fileset>
</path>
<path id="项目名称.classpath">
<pathelement location="build/classes"/>
<path refid="project_jar"/>
<path refid="jre_jar"/>
<path refid="jre_ext_jar"/>
<path refid="tomcat_jar"/>
</path>
<target name="clean">
<echo message="--------------------开始清理旧的编译文件---------------------------"/>
<delete dir="build/classes"/>
<delete file="${basedir}/build/${}.war"/>
</target>
<target name="init">
<echo message="---------------------开始拷贝资源文件-----------------------------"/>
<mkdir dir="build/classes"/>
<copy includeemptydirs="false" todir="build/classes">
<fileset dir="src">
<exclude name="**/*.java"/>
</fileset>
</copy>
<copy includeemptydirs="false" todir="build/classes">
<fileset dir="resources">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="build">
<echo message="-----------------------开始编译JAVA文件-----------------------------"/>
<echo message="${}: ${}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="build/classes" includeantruntime="false" source="${source}" target="${target}">
<src path="src"/>
<src path="resources"/>
<classpath refid="项目名称.classpath"/>
</javac>
</target>
<target name="packWar">
<echo message="-----------------------开始构建war包-----------------------------"/>
<war destfile="${basedir}/build/${}.war" webxml="${web}/WEB-INF/">
<fileset dir="${web}"/>
<classes dir="${}"/>
</war>
</target>
</project>