梦幻之旅

DEBUG - 天道酬勤

   :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  671 随笔 :: 6 文章 :: 256 评论 :: 0 Trackbacks
<?xml version="1.0"?>
<project name="javaTest" default="jar" basedir=".">
    
<target name="clean">
       
<delete dir="build"/>
    
</target>
    
<path id="classpath">  
        
<fileset  dir="lib">
          
<include name="*.jar"/>
        
</fileset>
    
</path>
    
<target name="compile" depends="clean">
       
<mkdir dir="build/classes"/>
      
<javac srcdir="src" destdir="build/classes" encoding="UTF-8">
          
<classpath refid="classpath"/>   
      
</javac>
    
</target>
    
<target name="run" depends="compile">
       
<java classname="Main">
           
<classpath>
              
<!--<classpath refid="classpath"/>-->
              
<pathelement path="build/classes"/>
           
</classpath>
       
</java>
    
</target>
    
<target name="copyConfig" depends="run">   
        
<copy todir="build/classes">   
                
<fileset dir="src">
                     
<include name="*.png" />
                
</fileset>
        
</copy>          
    
</target>    

    
<target name="jar" depends="copyConfig">
        
<pathconvert property="mf.classpath" pathsep=" ">
             
<mapper>
                 
<chainedmapper>
                     
<flattenmapper />
                     
<globmapper from="*" to="lib/*" />
                 
</chainedmapper>
             
</mapper>
             
<path refid="classpath" />
         
</pathconvert>


    
<jar destfile="main.jar" basedir="build/classes">
               
<manifest>
                  
<attribute name="Main-class" value="Main"/>
                      
<attribute name="Class-Path" value="${mf.classpath} "/>
               
</manifest>
     
</jar>
    
</target>
</project>
posted on 2010-12-20 11:41 HUIKK 阅读(5301) 评论(0)  编辑  收藏 所属分类: ANT

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


网站导航: