use maven to package and upgrade your application.

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.

你可能感兴趣的:(use maven to package and upgrade your application.)