Thursday, December 15, 2011

ANT: Appending a file to a jar/war/zip

Just use the update="true" attribute
 
Example :
<jar destfile="${project.deploy.location}/${project.deploy.name}.${project.type}" update="true">
  <zipfileset file="deploy/META-INF/version.properties" prefix="META-INF/"/>
</jar>

Notes:
Jar
  destfile - the jar file you want to add to
    project.type - this can be war/zip/ear etc
    project.deploy.name the name of your artifact
    project.deploy.location the location of your artifact

zipfileset
  file- the file you want to add to your jar
  prefix - the prefix/location for this file inside the jar

No comments:

Post a Comment