|
Ant example source code file (jar.xml)
The jar.xml source code<?xml version="1.0"?> <project name="jar-test" basedir="." default="test1"> <property name="tmp.jar" location="tmp.jar"/> <property name="tmp.dir" location="jartmp"/> <property name="tmp.zip" location="tmp.zip"/> <property name="tmp1.dir" location="jartmp1"/> <property name="tmp2.dir" location="jartmp2"/> <target name="test1"> <jar/> </target> <target name="test2"> <jar jarfile="jar.tmp" manifest="none" /> </target> <target name="test3"> <jar destfile="jar.tmp" whenempty="format C: /y" /> </target> <target name="test4"> <jar destfile="${tmp.jar}" basedir="." includes="jar.xml" /> </target> <target name="testNoRecreateWithUpdate"> <jar destfile="${tmp.jar}" basedir="." includes="jar.xml" update="true" /> </target> <target name="testRecreateNewerFileSetup" depends="test4"> <touch file="jar.xml"/> </target> <target name="testRecreateWithoutUpdateAdditionalFiles"> <jar destfile="${tmp.jar}" includes="*.xml" basedir="." /> </target> <target name="testRecreateWithUpdateAdditionalFiles"> <jar destfile="${tmp.jar}" basedir="." includes="*.xml" update="true" /> </target> <target name="testRecreateWithoutUpdateNewerFile"> <jar destfile="${tmp.jar}" basedir="." includes="jar.xml" /> </target> <target name="testRecreateWithUpdateNewerFile"> <jar destfile="${tmp.jar}" basedir="." includes="jar.xml" update="true" /> </target> <target name="testManifestStaysIntact"> <mkdir dir="${tmp.dir}"/> <manifest file="${tmp.dir}/manifest"> <attribute name="Foo" value="bar"/> </manifest> <jar destfile="${tmp.jar}" basedir="." includes="jar.xml" manifest="${tmp.dir}/manifest"/> <sleep seconds="3"/> <touch file="jar.xml"/> <jar destfile="${tmp.jar}" basedir="." includes="jar.xml" update="true"/> <unjar src="${tmp.jar}" dest="${tmp.dir}"/> </target> <target name="testNoRecreateBasedirExcludesWithUpdate"> <jar destfile="${tmp.jar}" basedir="." includes="j*.xml" excludes="java.xml" update="true" /> </target> <target name="testNoRecreateBasedirExcludesWithoutUpdate"> <jar destfile="${tmp.jar}" basedir="." includes="j*.xml" excludes="java.xml" /> </target> <target name="makezip"> <zip destfile="${tmp.zip}" basedir="." includes="j*.xml"/> </target> <target name="testNoRecreateZipfilesetExcludesWithUpdate" depends="makezip"> <jar destfile="${tmp.jar}" update="true"> <zipfileset src="${tmp.zip}" excludes="java.xml"/> </jar> </target> <target name="testNoRecreateZipfilesetExcludesWithoutUpdate" depends="makezip"> <jar destfile="${tmp.jar}"> <zipfileset src="${tmp.zip}" excludes="java.xml"/> </jar> </target> <target name="testRecreateZipfilesetWithoutUpdateAdditionalFiles" depends="makezip"> <jar destfile="${tmp.jar}"> <zipfileset src="${tmp.zip}"/> </jar> </target> <target name="testRecreateZipfilesetWithUpdateAdditionalFiles" depends="makezip"> <jar destfile="${tmp.jar}" update="true"> <zipfileset src="${tmp.zip}"/> </jar> </target> <target name="testRecreateZipfilesetWithoutUpdateNewerFile" depends="makezip"> <jar destfile="${tmp.jar}"> <zipfileset src="${tmp.zip}" includes="jar.xml"/> </jar> </target> <target name="testRecreateZipfilesetWithUpdateNewerFile" depends="makezip"> <jar destfile="${tmp.jar}" update="true"> <zipfileset src="${tmp.zip}" includes="jar.xml"/> </jar> </target> <target name="cleanup"> <delete file="${tmp.jar}" /> <delete file="${tmp.jar}2" /> <delete dir="${tmp.dir}"/> <delete file="${tmp.zip}" /> <delete dir="${tmp1.dir}"/> <delete dir="${tmp2.dir}"/> </target> <target name="testCreateWithEmptyFilesetSetUp"> <mkdir dir="${tmp1.dir}"/> <mkdir dir="${tmp2.dir}"/> <echo file="${tmp2.dir}/foo.txt" message="foo"/> </target> <target name="testCreateWithEmptyFileset"> <jar destfile="${tmp.jar}"> <fileset dir="${tmp1.dir}"> <include name="**/*.doesNotExist"/> </fileset> <fileset dir="${tmp2.dir}"> <include name="**/foo.txt"/> </fileset> </jar> </target> <!-- bug 17780 --> <target name="testUpdateIfOnlyManifestHasChanged" depends="test4"> <jar destfile="${tmp.jar}" update="true"> <manifest> <attribute name="Foo" value="bar"/> </manifest> </jar> <mkdir dir="${tmp.dir}"/> <unzip src="${tmp.jar}" dest="${tmp.dir}"/> </target> <!-- bugs 10262 and 16972 --> <target name="testIndexTests"> <mkdir dir="${tmp.dir}/META-INF"/> <touch file="${tmp.dir}/META-INF/INDEX.LIST"/> <touch file="${tmp.dir}/foo"/> <mkdir dir="${tmp.dir}/sub"/> <touch file="${tmp.dir}/sub/foo"/> <jar destfile="${tmp.jar}" index="yes" basedir="${tmp.dir}"/> </target> <!-- bug 32802 --> <target name="testManifestOnlyJar"> <mkdir dir="${tmp.dir}"/> <jar destfile="${tmp.jar}" duplicate="preserve"> <manifest> <attribute name="Foo" value="bar"/> </manifest> </jar> <mkdir dir="${tmp.dir}"/> <unzip src="${tmp.jar}" dest="${tmp.dir}"/> </target> <!-- bug 37237 --> <target name="testIndexJarsPlusJarMarker"> <mkdir dir="${tmp.dir}/a/b/c"/> <jar destfile="${tmp.jar}" basedir="${tmp.dir}"/> <delete dir="${tmp.dir}/a" quiet="true"/> <mkdir dir="${tmp.dir}/d/e/f"/> <jar destfile="${tmp.jar}2" basedir="${tmp.dir}" index="true"> <indexjars> <fileset file="${tmp.jar}"/> </indexjars> </jar> </target> </project> Other Ant examples (source code examples)Here is a short list of links related to this Ant jar.xml source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.