posts - 48, comments - 13, trackbacks - 0, articles - 0
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

用ant bulid时显示javac的文件列表

Posted on 2009-01-05 10:03 董锐 阅读(697) 评论(0)  编辑  收藏
在Eclipse下打开Window-preference,点击ant,钩中 create problem markers from "javac" results

在bulid.xml中配置红色属性就行了。

<project name="YGKH" default="help" basedir="." >

 <property name="build.dir" value="WEB-INF/classes"/>
 <property name="lib.dir" value="WEB-INF/lib"/>
 <property name="src.dir" value="src"/>
 
 <target name="help">
  <echo>
  This script requires Ant 1.5 or higher

  usage:
     ant -help  display ant help screen
     ant help   display this message
     ant clean  delete the built directory
     ant war   war
  </echo>
 </target>
 <path id="master-classpath">
  <fileset dir="${lib.dir}">
    <include name="*.jar"/>
  </fileset>
 </path>
 <target name="clean">
  <delete file="${war.file}" quiet="true"/>
  <delete dir="${build.dir}"/>
 </target>


 <target name="build" description="Compile main source tree java files into class files, generate jar files">

   <mkdir dir="${build.dir}"/>

   <javac destdir="${build.dir}"  listfiles="true"
    debug="true" deprecation="false" optimize="false" failonerror="true">
    <src path="${src.dir}"/>
    <classpath refid="master-classpath"/>
   </javac>
   <copy todir="${build.dir}" preservelastmodified="true">
     <fileset dir="${src.dir}">
      <include name="**/*.xml"/>
     </fileset>
   </copy>
 </target>

 <target name="war" depends="build">
  <war warfile="YGKH.war" webxml="WEB-INF/web.xml">
   <fileset dir="../YGKH">
    <include name="images/**"/>
    <include name="WEB-INF/**"/>
    <include name="css/**"/>
    <include name="js/**"/>
    <include name="*.html"/>
   </fileset>
   
  </war>
 </target>
 <target name="all" depends="clean,build,war" description="Clean,build,war"/>
</project>


只有注册用户登录后才能发表评论。


网站导航: