diff --git a/WHATSNEW b/WHATSNEW index ebffb7cb2..d392d2829 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -128,6 +128,10 @@ Fixed bugs: * JDependTask did not close an output file. Bugzilla Report 28557. +* can now optionally create an index for jars different than the + one it currently builds as well. See the new element + for details. Bugzilla Report 14255. + Other changes: -------------- diff --git a/docs/manual/CoreTasks/jar.html b/docs/manual/CoreTasks/jar.html index 2dcf4a10b..9b819b405 100644 --- a/docs/manual/CoreTasks/jar.html +++ b/docs/manual/CoreTasks/jar.html @@ -160,7 +160,13 @@ being wrapped and continued on the next line. index - whether to create an index list to speed up classloading. This is a JDK 1.3+ specific feature. Defaults to false. + whether to create an index + list to speed up classloading. This is a JDK 1.3+ specific + feature. Unless you specify additional jars with nested indexjars elements, only the + contents of this jar will be included in the index. Defaults to + false. No @@ -210,6 +216,32 @@ If the manifest values have changed the jar will be updated or rebuilt, as appropriate.

+

indexjars

+ +

since ant 1.6.2

+ +

The nested indexjars element specifies a PATH like structure. Its content is +completely ignored unless you set the index attribute of the task to +true.

+ +

The index created by this task will contain indices for the +archives contained in this path, the names used for the archioves +depend on your manifest:

+ + +

This task will not create any index entries for archives that are +empty or only contain files inside the META-INF directory.

+

Examples

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

jars all files in the ${build}/classes directory into a file diff --git a/src/main/org/apache/tools/ant/taskdefs/Jar.java b/src/main/org/apache/tools/ant/taskdefs/Jar.java index 9bc6a399d..20ecfa39e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Jar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Jar.java @@ -126,7 +126,7 @@ public class Jar extends Zip { /** * Path containing jars that shall be indexed in addition to this archive. * - * @since Ant 1.7 + * @since Ant 1.6.2 */ private Path indexJars; @@ -320,7 +320,7 @@ public class Jar extends Zip { } /** - * @since Ant 1.7 + * @since Ant 1.6.2 */ public void addConfiguredIndexJars(Path p) { if (indexJars == null) { @@ -706,7 +706,7 @@ public class Jar extends Zip { * Writes the directory entries from the first and the filenames * from the second list to the given writer, one entry per line. * - * @since Ant 1.7 + * @since Ant 1.6.2 */ protected final void writeIndexLikeList(List dirs, List files, PrintWriter writer) @@ -764,7 +764,7 @@ public class Jar extends Zip { *

if there is a classpath and the given file doesn't match any * of its entries, return null.

* - * @since Ant 1.7 + * @since Ant 1.6.2 */ protected static final String findJarName(String fileName, String[] classpath) {