You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David Esterkin <de...@chariotsolutions.com> on 2004/07/29 21:12:12 UTC

Problem nesting presetdef in another task

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="${user.name}"/>
             </manifest>
         </presetdef>

         <jar jarfile="anttest.jar" basedir="." includes="build.xml">
              <my.manifest/>
         </jar>
     </target>
</project>
------------------------------

Here is the output from executing the script above:
BUILD FAILED
/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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Java task spawn problem

Posted by Matt Benson <gu...@yahoo.com>.
Have you watched it in the Task Manager to see if a
new java process pops up?

-Matt

--- Chris <ch...@branaghgroup.com> wrote:

> I'm on XP with ant 1.6.2.  On verbose mode it even
> says "spawned process 
> java.lang.Win32Process@13adc56" and yet still
> nothing happens.
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



		
__________________________________
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now. 
http://messenger.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Java task spawn problem

Posted by Chris <ch...@branaghgroup.com>.
I'm on XP with ant 1.6.2.  On verbose mode it even says "spawned process 
java.lang.Win32Process@13adc56" and yet still nothing happens.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Java task spawn problem

Posted by Matt Benson <gu...@yahoo.com>.
--- Chris <ch...@branaghgroup.com> wrote:

> It just says "Build Successful" but doesn't spawn
> anything new.  I'm 
> running with both verbose and debug modes.  Is it
> possible i'm getting 
> errors that are preventing the spawned process but
> the messages aren't 
> getting shown in my original window?

Anything's possible.  :)  What OS are you running on?

-Matt


		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Java task spawn problem

Posted by Chris <ch...@branaghgroup.com>.
It just says "Build Successful" but doesn't spawn anything new.  I'm 
running with both verbose and debug modes.  Is it possible i'm getting 
errors that are preventing the spawned process but the messages aren't 
getting shown in my original window?

Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Java task spawn problem

Posted by Matt Benson <gu...@yahoo.com>.
What is or is not happening?  Try executing ant in
verbose and/or debug modes, -v and -d respectively.

-Matt

--- Chris <ch...@branaghgroup.com> wrote:

> Hey all I'm trying to execute my application using
> the java task along 
> with "spawn=true" but it doesn't seem to be working.
>  It seems like alot 
> of people have problems with the java task so i was
> wondering if anyone 
> had any ideas what i may be doing wrong?
> 
> <java classname="${class.run}" fork="true"
> spawn="true" 
> classpathref="class.path">
>                       <arg value="verbose:jni"/>
> </java>
> 
> Thanks!
> Chris
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Java task spawn problem

Posted by Chris <ch...@branaghgroup.com>.
Hey all I'm trying to execute my application using the java task along 
with "spawn=true" but it doesn't seem to be working.  It seems like alot 
of people have problems with the java task so i was wondering if anyone 
had any ideas what i may be doing wrong?

<java classname="${class.run}" fork="true" spawn="true" 
classpathref="class.path">
                      <arg value="verbose:jni"/>
</java>

Thanks!
Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Problem nesting presetdef in another task

Posted by David Esterkin <de...@chariotsolutions.com>.
Antoine,

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">
             <jar>
                 <manifest>
                     <attribute name="Built-By" value="${user.name}"/>
                 </manifest>
             </jar>
         </presetdef>

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


Thanks for the help,

David


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 
> http://ant.apache.org/manual/CoreTasks/manifest.html ).
> 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="${user.name}"/>
>>             </manifest>
>>         </presetdef>
>>
>>         <jar jarfile="anttest.jar" basedir="." includes="build.xml">
>>              <my.manifest/>
>>         </jar>
>>     </target>
>> </project>
>> ------------------------------
>>
>> Here is the output from executing the script above:
>> BUILD FAILED
>> /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: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Problem nesting presetdef in another task

Posted by Antoine Levy-Lambert <an...@gmx.de>.
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 
http://ant.apache.org/manual/CoreTasks/manifest.html ).
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="${user.name}"/>
>             </manifest>
>         </presetdef>
>
>         <jar jarfile="anttest.jar" basedir="." includes="build.xml">
>              <my.manifest/>
>         </jar>
>     </target>
> </project>
> ------------------------------
>
> Here is the output from executing the script above:
> BUILD FAILED
> /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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org