diff --git a/docs/manual/CoreTasks/jar.html b/docs/manual/CoreTasks/jar.html index 55f2e091d..d7aec7f50 100644 --- a/docs/manual/CoreTasks/jar.html +++ b/docs/manual/CoreTasks/jar.html @@ -426,34 +426,39 @@ depend on your manifest:

Examples

-
  <jar destfile="${dist}/lib/app.jar" basedir="${build}/classes"/>
+

Simple

+
  <jar destfile="${dist}/lib/app.jar" basedir="${build}/classes"/>

jars all files in the ${build}/classes directory into a file called app.jar in the ${dist}/lib directory.

-
  <jar destfile="${dist}/lib/app.jar"
+
+

With filters

+ +
  <jar destfile="${dist}/lib/app.jar"
        basedir="${build}/classes"
        excludes="**/Test.class"
-  />
+ />

jars all files in the ${build}/classes directory into a file called app.jar in the ${dist}/lib directory. Files with the name Test.class are excluded.

-
  <jar destfile="${dist}/lib/app.jar"
+
  <jar destfile="${dist}/lib/app.jar"
        basedir="${build}/classes"
        includes="mypackage/test/**"
        excludes="**/Test.class"
-  />
+ />

jars all files in the ${build}/classes directory into a file called app.jar in the ${dist}/lib directory. Only files under the directory mypackage/test are used, and files with the name Test.class are excluded.

-
  <jar destfile="${dist}/lib/app.jar">
+

Multiple filesets

+
  <jar destfile="${dist}/lib/app.jar">
     <fileset dir="${build}/classes"
              excludes="**/Test.class"
     />
     <fileset dir="${src}/resources"/>
-  </jar>
+ </jar>

jars all files in the ${build}/classes directory and also in the ${src}/resources directory together into a file called app.jar in the ${dist}/lib directory. @@ -463,19 +468,25 @@ and ${src}/resources/mypackage/image.gif, they will appear in the same directory in the JAR (and thus be considered in the same package by Java).

-
 <jar destfile="build/main/checksites.jar">
+

Using zipfileset

+ +
 <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>
+ </jar>

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 lib/main.

-
  <jar destfile="test.jar" basedir=".">
+
+

Inline manifest

+
  <jar destfile="test.jar" basedir=".">
     <include name="build"/>
     <manifest>
       <!-- Who is building this jar? -->
@@ -489,13 +500,14 @@ by Java).

<attribute name="Sealed" value="false"/> </section> </manifest> - </jar>
+ </jar>

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:

-
Manifest-Version: 1.0
+
+
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
+Sealed: false
+

Service Provider

The following shows how to create a jar file specifing a service @@ -517,6 +530,8 @@ Sealed: false </jar> + +

The following shows how to create a jar file specifing a service with two implementations of the JDK6 scripting interface: