You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by pe...@apache.org on 2010/05/19 16:03:23 UTC
svn commit: r946191 - /ant/core/trunk/docs/manual/CoreTasks/jar.html
Author: peterreilly
Date: Wed May 19 14:03:22 2010
New Revision: 946191
URL: http://svn.apache.org/viewvc?rev=946191&view=rev
Log:
attempt to make jar examples a little easier to read, update zipfileset example
Modified:
ant/core/trunk/docs/manual/CoreTasks/jar.html
Modified: ant/core/trunk/docs/manual/CoreTasks/jar.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/jar.html?rev=946191&r1=946190&r2=946191&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/jar.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/jar.html Wed May 19 14:03:22 2010
@@ -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/ima
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: