先在工程的根目录下建一个一builder.xml内容如下

<project basedir="." default="war" name="hb_portal">
<target name="init">
<property name="portal_name" value="湖北组件" />
<property name="version" value="1.0" />
<property name="year" value="2011" />
<property name="author" value="mathytht@gmail.com" />
<echo message="----------${portal_name} ${version} [${year}]  by [${author}]----" />
  <property name="deprecation" value="on" />  
<property name="src.dir" value="${basedir}/src" />  
 <property name="lib.dir" value="${basedir}/lib" />
 <property name="webapp.dir" value="${basedir}/WebRoot" /> 
 <property name="war.dest" value="${basedir}/build/war" />  
 <property name="build.src" value="${basedir}/build/src" />  
  <property name="build.dest" value="${basedir}/build/dest" />  
   
<path id="classpath">   
   <fileset dir="${lib.dir}">  
    <include name="**/*.jar"/>  
   </fileset>  
  </path>  
</target>
<target name="clean" depends="init">  
  <delete dir="${build.src}"/>  
  <delete dir="${build.dest}"/>  
  <delete dir="${war.dest}"/>  
 
 </target>  

<target name="prepare-src" depends="clean">  
  <mkdir dir="${build.src}" />  
  <mkdir dir="${build.dest}" />  
  <mkdir dir="${war.dest}" />  
    
    
  <!-- copy src files -->  
  <copy todir="${build.src}">  
   <fileset dir="${src.dir}" />  
  </copy>  
  <copy todir="${build.dest}">  
   <fileset dir="${webapp.dir}" />  
  </copy>  
   
 </target>  
<target name="build" depends="prepare-src">  
  <javac srcdir="${build.src}" destdir="${build.dest}/WEB-INF/classes">  
   <classpath refid="classpath" />  
  </javac>  
  <copy todir="${build.dest}/WEB-INF/classes">  
   <fileset dir="${build.src}" >  
    <include name="**/*.xml"/>  
   </fileset>  
  </copy>  
 </target>  
  
 <!-- =================================================================== -->  
 <!-- 打war包-->  
 <!-- =================================================================== -->  
  
 <target name="war" depends="build">  
  <war warfile="${war.dest}/portal.war" webxml="${build.dest}/WEB-INF/web.xml">  
  
  
   <fileset dir="${build.dest}">  
       <exclude name="WEB-INF/lib"/>  
   </fileset>  
  </war>  
   
 </target>  

</project>

在具体的从svn上导入的原myeclipse的项目上右键-->properites-->builders-->new-->ant builder 

builder file 选中builder.xml

base directory 选中工程根目录

targets选项卡按情况更改--》这里设好了(注意ant.jar的引用)

转自:http://blog.csdn.net/fantasy0126/article/details/6335793

 

posted on 2013-11-13 10:24  小码农_ZXB  阅读(686)  评论(0编辑  收藏  举报