use maven to package and upgrade your application.
Posted on 2009-06-07 14:25 不需要解釋 閱讀(282) 評論(0) 編輯 收藏 所屬分類: ant 、mavenMave 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.