|
|
@@ -426,34 +426,39 @@ depend on your manifest:</p> |
|
|
|
|
|
|
|
<h3>Examples</h3> |
|
|
|
|
|
|
|
<pre> <jar destfile="${dist}/lib/app.jar" basedir="${build}/classes"/></pre> |
|
|
|
<h4>Simple</h4> |
|
|
|
<blockquote><pre> <jar destfile="${dist}/lib/app.jar" basedir="${build}/classes"/></pre></blockquote> |
|
|
|
<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 destfile="${dist}/lib/app.jar" |
|
|
|
|
|
|
|
<h4>With filters</h4> |
|
|
|
|
|
|
|
<blockquote><pre> <jar destfile="${dist}/lib/app.jar" |
|
|
|
basedir="${build}/classes" |
|
|
|
excludes="**/Test.class" |
|
|
|
/></pre> |
|
|
|
/></pre></blockquote> |
|
|
|
<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 destfile="${dist}/lib/app.jar" |
|
|
|
<blockquote><pre> <jar destfile="${dist}/lib/app.jar" |
|
|
|
basedir="${build}/classes" |
|
|
|
includes="mypackage/test/**" |
|
|
|
excludes="**/Test.class" |
|
|
|
/></pre> |
|
|
|
/></pre></blockquote> |
|
|
|
<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. 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 destfile="${dist}/lib/app.jar"> |
|
|
|
<h4>Multiple filesets</h4> |
|
|
|
<blockquote><pre> <jar destfile="${dist}/lib/app.jar"> |
|
|
|
<fileset dir="${build}/classes" |
|
|
|
excludes="**/Test.class" |
|
|
|
/> |
|
|
|
<fileset dir="${src}/resources"/> |
|
|
|
</jar></pre> |
|
|
|
</jar></pre></blockquote> |
|
|
|
<p>jars all files in the <code>${build}/classes</code> directory and also |
|
|
|
in the <code>${src}/resources</code> directory together into a file |
|
|
|
called <code>app.jar</code> in the <code>${dist}/lib</code> directory. |
|
|
@@ -463,19 +468,25 @@ 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 destfile="build/main/checksites.jar"> |
|
|
|
<h4>Using zipfileset</h4> |
|
|
|
|
|
|
|
<blockquote><pre> <jar destfile="build/main/checksites.jar"> |
|
|
|
<fileset dir="build/main/classes"/> |
|
|
|
<zipfileset src="lib/main/util.jar"> |
|
|
|
<zipfileset includes="**/*.class"> |
|
|
|
<fileset dir="lib/main" includes="**/*.jar"/> |
|
|
|
</zipfileset> |
|
|
|
<manifest> |
|
|
|
<attribute name="Main-Class" |
|
|
|
value="com.acme.checksites.Main"/> |
|
|
|
</manifest> |
|
|
|
</jar></pre> |
|
|
|
</jar></pre></blockquote> |
|
|
|
<p> |
|
|
|
Creates an executable jar file with a main class "com.acme.checksites.Main", and |
|
|
|
embeds all the classes from util.jar. |
|
|
|
embeds all the classes from all the jars in <code>lib/main</code>. |
|
|
|
</p> |
|
|
|
<pre> <jar destfile="test.jar" basedir="."> |
|
|
|
|
|
|
|
<h4>Inline manifest</h4> |
|
|
|
<blockquote><pre> <jar destfile="test.jar" basedir="."> |
|
|
|
<include name="build"/> |
|
|
|
<manifest> |
|
|
|
<!-- Who is building this jar? --> |
|
|
@@ -489,13 +500,14 @@ by Java).</p> |
|
|
|
<attribute name="Sealed" value="false"/> |
|
|
|
</section> |
|
|
|
</manifest> |
|
|
|
</jar></pre> |
|
|
|
</jar></pre></blockquote> |
|
|
|
<p> |
|
|
|
This is an example of an inline manifest specification including the version of the build |
|
|
|
program (Implementation-Version). Note that the Built-By attribute will take the value of the Ant |
|
|
|
property ${user.name}. The manifest produced by the above would look like this: |
|
|
|
</p> |
|
|
|
<pre><code>Manifest-Version: 1.0 |
|
|
|
|
|
|
|
<blockquote><pre><code>Manifest-Version: 1.0 |
|
|
|
Built-By: conor |
|
|
|
Implementation-Vendor: ACME inc. |
|
|
|
Implementation-Title: GreatProduct |
|
|
@@ -503,8 +515,9 @@ Implementation-Version: 1.0.0beta2 |
|
|
|
Created-By: Apache Ant 1.7.0 |
|
|
|
|
|
|
|
Name: common/MyClass.class |
|
|
|
Sealed: false</code></pre> |
|
|
|
Sealed: false</code></pre></blockquote> |
|
|
|
|
|
|
|
<h4>Service Provider</h4> |
|
|
|
|
|
|
|
<p> |
|
|
|
The following shows how to create a jar file specifing a service |
|
|
@@ -517,6 +530,8 @@ Sealed: false</code></pre> |
|
|
|
</jar> |
|
|
|
</pre></blockquote> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<p> |
|
|
|
The following shows how to create a jar file specifing a service |
|
|
|
with two implementations of the JDK6 scripting interface: |
|
|
|