ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Esterkin <>
Subject Re: Problem nesting presetdef in another task
Date Thu, 29 Jul 2004 20:11:09 GMT

Your explanation about the two different, and incompatible, manifest tags
makes a lot of sense.  I was thinking of presetdef more like an xml entity,
which is probably not the case.

Your answer also gave me an idea for a rather simple workaround. I am now
wrapping the whole jar statement inside the presetdef like the following:

     <target name="jar">
         <presetdef name="my.jar">
                     <attribute name="Built-By" value="${}"/>

         <my.jar destfile="my.jar" basedir="." includes="build.xml"/>

Thanks for the help,


Antoine Levy-Lambert wrote:
> Hello,
> this sounds like a bug or a limitation of presetdef. The documentation 
> says that presetdef can be used with any type or task.
> There is another issue which can explain the problem.
> the <manifest/> tag inside a target or the body of a project is a task 
> used to create a manifest file.(see 
> ).
> the same <manifest/> tag inside <jar/> or a task derived from jar (war, 
> ear) instructs ant to create an inline manifest for the archive.
> In this case, the <manifest/> tag refers to another Java class.
> I do not know enough how presetdef is implemented and how introspection 
> works to figure out what is happening.
> It is possible that presetdef thinks that you are referring to the 
> manifest task, which is globally known in ant. The manifest nested type 
> of jar is only known in jar and derivatives.
> Cheers,
> Antoine
> David Esterkin wrote:
>> Hello,
>> I created a presetdef of a <manifest> element, and then tried to use 
>> it as a sub-element of <jar>.
>> When I execute the script, the build fails with a message stating this 
>> is an unsupported nested element.
>> Here is a sample build script.  In addition, to the form shown below, 
>> I have tried defining the presetdef outside of any targets (as a 
>> direct sub-element of project),
>> ------------------------------
>> <?xml version="1.0"?>
>> <project name="anttest" default="jar" basedir=".">
>>     <target name="jar">
>>         <presetdef name="my.manifest">
>>             <manifest>
>>                 <attribute name="Built-By" value="${}"/>
>>             </manifest>
>>         </presetdef>
>>         <jar jarfile="anttest.jar" basedir="." includes="build.xml">
>>              <my.manifest/>
>>         </jar>
>>     </target>
>> </project>
>> ------------------------------
>> Here is the output from executing the script above:
>> /java/projects/anttest/build.xml:11: The <jar> type doesn't support 
>> the nested "my.manifest" element.
>> Thanks for any help with this.
>> David
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message