烦恼岁月

付出总是有回报的 take action follow your heart , or follow your head
posts - 40, comments - 5, trackbacks - 0, articles - 4

use maven to package and upgrade your application.

Posted on 2009-06-07 14:25 不需要解释 阅读(280) 评论(0)  编辑  收藏 所属分类: antmaven

Mave is good at jar management. so maven can help me to package the java application. with maven help, we can make the release application zip smaller.

for the smaller:we use the maven ant task to manager jars:

build.xml

<project basedir="." default="all" name="jars" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<property name="build.compiler" value="modern"/>
     <path id="maven-ant-tasks.classpath" path="${basedir}/maven/maven-ant-tasks-2.0.10.jar" />
  <typeset resource="org/apache/maven/artifact/ant/antlib.xml"
           uri="antlib:org.apache.maven.artifact.ant"
           classpathref="maven-ant-tasks.classpath" />

    <target name="all">
          <antcall target="get_server_jars"/>
          <antcall target="get_orchis_jars"/>
    </target>

    <target name="get_server_jars">
        <artifact:dependencies pathId="dependency.classpath"  filesetId="maven.fileset">
        <dependency groupId="junit" artifactId="junit" version="3.8.2"/>  
        <dependency groupId="activation" artifactId="activation" version="1.1"/>    
        <dependency groupId="castor" artifactId="castor" version="1.1"/>    

        </artifact:dependencies>

    <copy todir="${basedir}/lib">
        <fileset refid="maven.fileset" />
        <!-- This mapped strips off all leading directory information -->
        <mapper type="flatten" />
    </copy>
</target>

    <target name="get_orchis_jars">
        <artifact:dependencies pathId="dependency.classpath"  filesetId="maven.fileset">
            <dependency groupId="junit" artifactId="junit" version="3.8.2"/>       
            <dependency groupId="javax.servlet" artifactId="servlet-api" version="2.4"/>      
        </artifact:dependencies>

    <copy todir="${basedir}/webapps/ROOT/WEB-INF/lib">
        <fileset refid="maven.fileset" />
        <!-- This mapper strips off all leading directory information -->
        <mapper type="flatten" />
    </copy>
</target>

so we can use maven to update you application.


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


网站导航:
 
我实话告诉你们,我可是身经百战了.bbs我见的多了,哪个版我没灌过?你们要知道, 一塌糊 涂的triangle,PIC,SEX版,那比你们不知道厉害到哪里去了,我在那谈笑风声.你 们有一好就是无论在哪个版,什么话题都灌,但是灌来灌去的问题,都too simple, sometimes naive!你 们懂不懂呀?啊?所以说灌水啊,关键是要提高自己的知识水平.你 们啊,不要总想着弄个大坑,然后灌上十大,再把我羞辱一番……你们啊,naive!你们这 样灌是不行地!~那你問我支持 不支持灌水,我說支持,我常來這裡灌,你說支持不支持?