git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270605 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -24,8 +24,8 @@ attributes of zipfilesets in a Zip or Jar task.)</p> | |||
| <td align="center" valign="top"><b>Required</b></td> | |||
| </tr> | |||
| <tr> | |||
| <td valign="top">file</td> | |||
| <td valign="top">the ear-file to create.</td> | |||
| <td valign="top">destfile</td> | |||
| <td valign="top">the EAR file to create.</td> | |||
| <td valign="top" align="center">Yes</td> | |||
| </tr> | |||
| <tr> | |||
| @@ -107,7 +107,7 @@ fileset includes a file named <code>MANIFEST.MF</code>, the file is | |||
| ignored and you will get a warning.</p> | |||
| <h2>Example</h2> | |||
| <pre> | |||
| <ear file="${build.dir}/myapp.ear" appxml="${src.dir}/metadata/application.xml"> | |||
| <ear destfile="${build.dir}/myapp.ear" appxml="${src.dir}/metadata/application.xml"> | |||
| <fileset dir="${build.dir}" includes="*.jar,*.war"/> | |||
| </ear> | |||
| </pre> | |||
| @@ -58,8 +58,8 @@ being wrapped and continued on the next line. | |||
| <td align="center" valign="top"><b>Required</b></td> | |||
| </tr> | |||
| <tr> | |||
| <td valign="top">file</td> | |||
| <td valign="top">the jar-file to create.</td> | |||
| <td valign="top">destfile</td> | |||
| <td valign="top">the JAR file to create.</td> | |||
| <td valign="top" align="center">Yes</td> | |||
| </tr> | |||
| <tr> | |||
| @@ -157,14 +157,14 @@ the resulting Jar. | |||
| <pre> <jar file="${dist}/lib/app.jar" basedir="${build}/classes"/></pre> | |||
| <p>jars all files in the <code>${build}/classes</code> directory into a file | |||
| called <code>app.jar</code> in the <code>${dist}/lib</code> directory.</p> | |||
| <pre> <jar file="${dist}/lib/app.jar" | |||
| <pre> <jar destfile="${dist}/lib/app.jar" | |||
| basedir="${build}/classes" | |||
| excludes="**/Test.class" | |||
| /></pre> | |||
| <p>jars all files in the <code>${build}/classes</code> directory into a file | |||
| called <code>app.jar</code> in the <code>${dist}/lib</code> directory. Files | |||
| with the name <code>Test.class</code> are excluded.</p> | |||
| <pre> <jar file="${dist}/lib/app.jar" | |||
| <pre> <jar destfile="${dist}/lib/app.jar" | |||
| basedir="${build}/classes" | |||
| includes="mypackage/test/**" | |||
| excludes="**/Test.class" | |||
| @@ -173,7 +173,7 @@ with the name <code>Test.class</code> are excluded.</p> | |||
| called <code>app.jar</code> in the <code>${dist}/lib</code> directory. Only | |||
| files under the directory <code>mypackage/test</code> are used, and files with | |||
| the name <code>Test.class</code> are excluded.</p> | |||
| <pre> <jar file="${dist}/lib/app.jar"> | |||
| <pre> <jar destfile="${dist}/lib/app.jar"> | |||
| <fileset dir="${build}/classes" | |||
| excludes="**/Test.class" | |||
| /> | |||
| @@ -188,7 +188,7 @@ and <code>${src}/resources/mypackage/image.gif</code>, they will appear | |||
| in the same directory in the JAR (and thus be considered in the same package | |||
| by Java).</p> | |||
| <pre> <jar jarfile="test.jar" basedir="."> | |||
| <pre> <jar destfile="test.jar" basedir="."> | |||
| <include name="build"/> | |||
| <manifest> | |||
| <attribute name="Built-By" value="${user.name}"/> | |||
| @@ -26,8 +26,8 @@ attributes of zipfilesets in a Zip or Jar task.)</p> | |||
| <td align="center" valign="top"><b>Required</b></td> | |||
| </tr> | |||
| <tr> | |||
| <td valign="top">file</td> | |||
| <td valign="top">the war-file to create.</td> | |||
| <td valign="top">destfile</td> | |||
| <td valign="top">the WAR file to create.</td> | |||
| <td valign="top" align="center">Yes</td> | |||
| </tr> | |||
| <tr> | |||
| @@ -135,7 +135,7 @@ src/graphics/images/gifs/large/logo.gif | |||
| </pre> | |||
| then the war file <code>myapp.war</code> created with | |||
| <pre> | |||
| <war file="myapp.war" webxml="src/metadata/myapp.xml"> | |||
| <war destfile="myapp.war" webxml="src/metadata/myapp.xml"> | |||
| <fileset dir="src/html/myapp"/> | |||
| <fileset dir="src/jsp/myapp"/> | |||
| <lib dir="thirdparty/libs"> | |||
| @@ -57,7 +57,7 @@ Java.</p> | |||
| <td valign="top" align="center"><b>Required</b></td> | |||
| </tr> | |||
| <tr> | |||
| <td valign="top">file</td> | |||
| <td valign="top">destfile</td> | |||
| <td valign="top">the zip-file to create.</td> | |||
| <td align="center" valign="top">Yes</td> | |||
| </tr> | |||
| @@ -142,12 +142,12 @@ contents will be extracted and included in the archive. As with directories, in | |||
| for inclusion in the archive.</p> | |||
| <h3>Examples</h3> | |||
| <pre> <zip file="${dist}/manual.zip" | |||
| <pre> <zip destfile="${dist}/manual.zip" | |||
| basedir="htdocs/manual" | |||
| /></pre> | |||
| <p>zips all files in the <code>htdocs/manual</code> directory into a file called <code>manual.zip</code> | |||
| in the <code>${dist}</code> directory.</p> | |||
| <pre> <zip file="${dist}/manual.zip" | |||
| <pre> <zip destfile="${dist}/manual.zip" | |||
| basedir="htdocs/manual" | |||
| update="true" | |||
| /></pre> | |||
| @@ -155,27 +155,27 @@ in the <code>${dist}</code> directory.</p> | |||
| in the <code>${dist}</code> directory. If <code>manual.zip</code> | |||
| doesn't exist, it is created; otherwise it is updated with the | |||
| new/changed files.</p> | |||
| <pre> <zip file="${dist}/manual.zip" | |||
| <pre> <zip destfile="${dist}/manual.zip" | |||
| basedir="htdocs/manual" | |||
| excludes="mydocs/**, **/todo.html" | |||
| /></pre> | |||
| <p>zips all files in the <code>htdocs/manual</code> directory. Files in the directory <code>mydocs</code>, | |||
| or files with the name <code>todo.html</code> are excluded.</p> | |||
| <pre> <zip file="${dist}/manual.zip" | |||
| <pre> <zip destfile="${dist}/manual.zip" | |||
| basedir="htdocs/manual" | |||
| includes="api/**/*.html" | |||
| excludes="**/todo.html" | |||
| /></pre> | |||
| <p>zips all files in the <code>htdocs/manual</code> directory. Only html files under the directory <code>api</code> | |||
| are zipped, and files with the name <code>todo.html</code> are excluded.</p> | |||
| <pre> <zip file="${dist}/manual.zip"> | |||
| <pre> <zip destfile="${dist}/manual.zip"> | |||
| <fileset dir="htdocs/manual"/> | |||
| <fileset dir="." includes="ChangeLog.txt"/> | |||
| </zip></pre> | |||
| <p>zips all files in the <code>htdocs/manual</code> directory, and also adds the file <code>ChangeLog.txt</code> in the | |||
| current directory. <code>ChangeLog.txt</code> will be added to the top of the ZIP file, just as if | |||
| it had been located at <code>htdocs/manual/ChangeLog.txt</code>.</p> | |||
| <pre> <zip file="${dist}/manual.zip"> | |||
| <pre> <zip destfile="${dist}/manual.zip"> | |||
| <zipfileset dir="htdocs/manual" prefix="docs/user-guide"/> | |||
| <zipfileset dir="." includes="ChangeLog27.txt" fullpath="docs/ChangeLog.txt"/> | |||
| <zipfileset src="examples.zip" includes="**/*.html" prefix="docs/examples"/> | |||
| @@ -15,7 +15,7 @@ | |||
| <target name="test3"> | |||
| <jar | |||
| jarfile="jar.tmp" | |||
| destfile="jar.tmp" | |||
| whenempty="format C: /y" | |||
| /> | |||
| </target> | |||
| @@ -24,7 +24,7 @@ | |||
| <!-- delete the tmp.jar or the next test will fail --> | |||
| <delete file="tmp.jar"/> | |||
| <jar | |||
| jarfile="tmp.jar" | |||
| destfile="tmp.jar" | |||
| basedir="." | |||
| includes="jar.xml" | |||
| /> | |||
| @@ -33,10 +33,10 @@ | |||
| <!-- This test is to make sure upToDate is working --> | |||
| <target name="test5"> | |||
| <jar | |||
| jarfile="tmp.jar" | |||
| destfile="tmp.jar" | |||
| basedir="." | |||
| includes="jar.xml" | |||
| /> | |||
| </target> | |||
| </project> | |||
| </project> | |||
| @@ -7,21 +7,21 @@ | |||
| </target> | |||
| <target name="test2"> | |||
| <zip zipfile="zip.tmp"/> | |||
| <zip destFile="zip.tmp"/> | |||
| </target> | |||
| <!-- Test when the zip file includes itself | |||
| when target file exists before the zip task is run --> | |||
| <target name="test3"> | |||
| <touch file="test3.zip"/> | |||
| <zip zipfile="test3.zip" | |||
| <zip destFile="test3.zip" | |||
| basedir="."/> | |||
| </target> | |||
| <!-- Test when the zip file includes itself | |||
| when target file does not exist before the zip task is run --> | |||
| <target name="test4"> | |||
| <zip zipfile="test4.zip" | |||
| <zip destFile="test4.zip" | |||
| basedir="."/> | |||
| </target> | |||
| @@ -32,28 +32,35 @@ | |||
| </target> | |||
| <target name="test6"> | |||
| <zip zipfile="test6.zip" basedir="."> | |||
| <zip destFile="test6.zip" basedir="."> | |||
| <include name="*.xml" /> | |||
| <exclude name="zip.*" /> | |||
| </zip> | |||
| </target> | |||
| <target name="test7"> | |||
| <zip zipfile="inner7.zip" basedir="." > | |||
| <zip destFile="inner7.zip" basedir="." > | |||
| <exclude name="inner7.zip" /> | |||
| </zip> | |||
| <zip zipfile="test7.zip" basedir="."> | |||
| <zip destFile="test7.zip" basedir="."> | |||
| <exclude name="**/*.*" /> | |||
| <zipfileset src="inner7.zip" /> | |||
| </zip> | |||
| </target> | |||
| <target name="feather"> | |||
| <zip zipfile="asf-logo.gif.zip" | |||
| <zip destFile="asf-logo.gif.zip" | |||
| basedir=".." | |||
| includes="asf-logo.gif" /> | |||
| </target> | |||
| <!-- legacy attribute support --> | |||
| <target name="test8"> | |||
| <zip zipfile="test8.zip" basedir="." > | |||
| <exclude name="test8.zip" /> | |||
| </zip> | |||
| </target> | |||
| <target name="cleanup"> | |||
| <delete file="test3.zip"/> | |||
| <delete file="test4.zip"/> | |||
| @@ -79,11 +79,17 @@ public class Ear extends Jar { | |||
| emptyBehavior = "create"; | |||
| } | |||
| /** | |||
| * @deprecated Use setDestFile(destfile) instead | |||
| */ | |||
| public void setEarfile(File earFile) { | |||
| log("DEPRECATED - The earfile attribute is deprecated. Use file attribute instead."); | |||
| setFile(earFile); | |||
| log("DEPRECATED - The earfile attribute is deprecated. Use destfile attribute instead."); | |||
| setDestFile(earFile); | |||
| } | |||
| /** | |||
| * set the application XML file | |||
| */ | |||
| public void setAppxml(File descr) { | |||
| deploymentDescriptor = descr; | |||
| if (!deploymentDescriptor.exists()) | |||
| @@ -121,11 +127,11 @@ public class Ear extends Jar { | |||
| protected void zipFile(File file, ZipOutputStream zOut, String vPath) | |||
| throws IOException | |||
| { | |||
| // If the file being added is WEB-INF/web.xml, we warn if it's not the | |||
| // one specified in the "webxml" attribute - or if it's being added twice, | |||
| // meaning the same file is specified by the "webxml" attribute and in | |||
| // If the file being added is META-INF/application.xml, we warn if it's not the | |||
| // one specified in the "appxml" attribute - or if it's being added twice, | |||
| // meaning the same file is specified by the "appxml" attribute and in | |||
| // a <fileset> element. | |||
| if (vPath.equalsIgnoreCase("META-INF/aplication.xml")) { | |||
| if (vPath.equalsIgnoreCase("META-INF/application.xml")) { | |||
| if (deploymentDescriptor == null || !deploymentDescriptor.equals(file) || descriptorAdded) { | |||
| log("Warning: selected "+archiveType+" files include a META-INF/application.xml which will be ignored " + | |||
| "(please use appxml attribute to "+archiveType+" task)", Project.MSG_WARN); | |||
| @@ -139,7 +145,7 @@ public class Ear extends Jar { | |||
| } | |||
| /** | |||
| * Make sure we don't think we already have a web.xml next time this task | |||
| * Make sure we don't think we already have a application.xml next time this task | |||
| * gets executed. | |||
| */ | |||
| protected void cleanUp() { | |||
| @@ -97,11 +97,11 @@ public class Jar extends Zip { | |||
| } | |||
| /** | |||
| * @deprecated use setFile(File) instead. | |||
| * @deprecated Use setDestFile(File) instead | |||
| */ | |||
| public void setJarfile(File jarFile) { | |||
| log("DEPRECATED - The jarfile attribute is deprecated. Use file attribute instead."); | |||
| setFile(jarFile); | |||
| log("DEPRECATED - The jarfile attribute is deprecated. Use destfile attribute instead."); | |||
| setDestFile(jarFile); | |||
| } | |||
| /** | |||
| @@ -79,11 +79,17 @@ public class War extends Jar { | |||
| emptyBehavior = "create"; | |||
| } | |||
| /** | |||
| * @deprecated Use setDestFile(File) instead | |||
| */ | |||
| public void setWarfile(File warFile) { | |||
| log("DEPRECATED - The warfile attribute is deprecated. Use file attribute instead."); | |||
| setFile(warFile); | |||
| log("DEPRECATED - The warfile attribute is deprecated. Use destfile attribute instead."); | |||
| setDestFile(warFile); | |||
| } | |||
| /** | |||
| * set the web app descriptor for this WAR file | |||
| */ | |||
| public void setWebxml(File descr) { | |||
| deploymentDescriptor = descr; | |||
| if (!deploymentDescriptor.exists()) | |||
| @@ -120,22 +120,38 @@ public class Zip extends MatchingTask { | |||
| * This is the name/location of where to | |||
| * create the .zip file. | |||
| * | |||
| * @deprecated Use setFile() instead | |||
| * @deprecated Use setDestFile(File) instead | |||
| */ | |||
| public void setZipfile(File zipFile) { | |||
| log("DEPRECATED - The zipfile attribute is deprecated. Use file attribute instead."); | |||
| setFile( zipFile ); | |||
| log("DEPRECATED - The zipfile attribute is deprecated. Use destfile attribute instead."); | |||
| setDestFile(zipFile); | |||
| } | |||
| /** | |||
| * This is the name/location of where to | |||
| * create the .zip file. | |||
| * | |||
| * @since 1.5alpha | |||
| * @todo pull this before shipping 1.5 | |||
| * @deprecated Use setDestFile(File) instead | |||
| */ | |||
| public void setFile(File file) { | |||
| this.zipFile = file; | |||
| log("DEPRECATED - The file attribute has been renamed destfile." | |||
| +" This attribute will be unsupported before Ant1.5 is released", | |||
| Project.MSG_ERR); | |||
| setDestFile(file); | |||
| } | |||
| /** | |||
| * Sets the destfile attribute. | |||
| * @since 1.5 | |||
| * @param destFile The new destination File | |||
| */ | |||
| public void setDestFile(File destFile) { | |||
| this.zipFile = destFile; | |||
| } | |||
| /** | |||
| * This is the base directory to look in for | |||
| * things to zip. | |||
| @@ -101,4 +101,8 @@ public class ZipTest extends BuildFileTest { | |||
| public void test7() { | |||
| executeTarget("test7"); | |||
| } | |||
| public void test8() { | |||
| executeTarget("test8"); | |||
| } | |||
| } | |||