diff --git a/WHATSNEW b/WHATSNEW
index 018768dba..1efd23438 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -36,6 +36,9 @@ Other changes:
*
(The Ear task is a shortcut for specifying the particular layout of a EAR file. The same thing can be accomplished by using the prefix and fullpath attributes of zipfilesets in a Zip or Jar task.)
-The extended zipfileset element from the zip task (with attributes prefix, fullpath, and src) is available in the War task.
+The extended zipfileset element from the zip task (with attributes prefix, fullpath, and src) is available in the Ear task.
No |
The nested metainf
element specifies a FileSet. All files included in this fileset will
+end up in the META-INF
directory of the ear file. If this
+fileset includes a file named MANIFEST.MF
, the file is
+ignored and you will get a warning.
<ear earfile="${build.dir}/myapp.ear" appxml="${src.dir}/metadata/application.xml"> diff --git a/docs/manual/CoreTasks/jar.html b/docs/manual/CoreTasks/jar.html index 516eb7764..02f362b74 100644 --- a/docs/manual/CoreTasks/jar.html +++ b/docs/manual/CoreTasks/jar.html @@ -106,6 +106,13 @@ include an empty one for you.)No +Nested elements
+metainf
+The nested
metainf
element specifies a FileSet. All files included in this fileset will +end up in theMETA-INF
directory of the jar file. If this +fileset includes a file namedMANIFEST.MF
, the file is +ignored and you will get a warning.Examples
<jar jarfile="${dist}/lib/app.jar" basedir="${build}/classes"/>jars all files in the
+${build}/classes
directory into a file diff --git a/docs/manual/CoreTasks/war.html b/docs/manual/CoreTasks/war.html index dff6c6f7f..056eee039 100644 --- a/docs/manual/CoreTasks/war.html +++ b/docs/manual/CoreTasks/war.html @@ -101,6 +101,12 @@ href="../CoreTypes/fileset.html">FileSet. All files included in this fileset end up in theWEB-INF
directory of the war file. If this fileset includes a file namedweb.xml
, the file is ignored and you will get a warning.metainf
+The nested
metainf
element specifies a FileSet. All files included in this fileset will +end up in theMETA-INF
directory of the war file. If this +fileset includes a file namedMANIFEST.MF
, the file is +ignored and you will get a warning.Examples
Assume the following structure in the project's base directory:
diff --git a/src/main/org/apache/tools/ant/taskdefs/Jar.java b/src/main/org/apache/tools/ant/taskdefs/Jar.java index 6d1dcd4f9..d69dd4289 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Jar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Jar.java @@ -94,6 +94,11 @@ public class Jar extends Zip { super.addFileset(fs); } + public void addMetainf(ZipFileSet fs) { + // We just set the prefix for this fileset, and pass it up. + fs.setPrefix("META-INF/"); + super.addFileset(fs); + } protected void initZipOutputStream(ZipOutputStream zOut) throws IOException, BuildException