You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by VR Venugopal Rao <ve...@cmcltd.com> on 2011/08/29 08:38:17 UTC

Why is the java command not executing

Output:

The Build is sucessfuly creating the jar file but not executing the Java
file.
Any idea why the java is not executing the file.
Regards,
Venu.



<?xml version="1.0" encoding="UTF-8"?>
<!--  		packagenames="org.*, de.*, test.*, writer.*"	-->
<project name="structured" default="archive" >
<target name="init">
	<mkdir dir="build/classes" />
	<mkdir dir="build/classes/docs" />
	<mkdir dir="dist" />
	</target>

	<target name="compile" depends="init" >
		<javac srcdir="src"
		destdir="build/classes"/>
	</target>
<target name="javadocs" depends="compile" description="make the java docs" >
	<javadoc author="true"
		destdir="build/classes/docs" 
		packagenames="org.*"
		sourcepath="src"
		use="true"
		version="true"
		windowtitle="documentation"
		private="true">
		<classpath refid="compile.classpath"/>
	</javadoc>
</target>

<target name="archive" depends="compile" >
	<jar destfile="dist/project.jar"
	basedir="build/classes" />
</target>

<target name="execute" depends="compile">
	<java
	classname="org.example.antbook.lesson1.Main"
	classpath="build/classes">
	<arg value="a"/>
	<arg value="b"/>
	<arg file="."/>
	</java>
	
	<java 
		classname="org.example.antbook.lesson1.HelloWorld"
		classpath="build/classes">
	</java>
</target>
<target name="clean" depends="execute">
	<delete dir="build" />
	<delete dir="dist" />
</target>


</project>



______________________________________________________________________________

DISCLAIMER

The information contained in this e-mail message and/or attachments to it may
contain confidential or privileged information. If you are not the intended
recipient, any dissemination, use, review, distribution, printing or copying
of the information contained in this e-mail message and/or attachments to it
are strictly prohibited. If you have received this communication in error,
please notify us by reply e-mail or directly to netsupport@cmcltd.com or
telephone and immediately and permanently delete the message and any
attachments. Thank you.

______________________________________________________________________________

This email has been scrubbed for your protection by SecureMX.
For more information visit http://securemx.in
_____________________________________________________________________________

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


RE: Why is the java command not executing

Posted by "Echlin, Robert" <Ro...@windriver.com>.
Hi Venu,
The docs are useful and generally clear, as Parag mentions.
Recommended.
I have an old version of the printed manual "Ant - the Definitive Guide", and I used it a lot when I was starting with Ant.
I like books for some purposes. Your choice.

Anyway, to answer your question:
The dependencies determine the order.
What you tell it to do determines what gets done.

If you run with the following command with your existing file:
   $ ant archive execute
It will do both.

If you run: 
  $   ant
It will do the default thing - which you have specified as "archive".

You can create a new target called "all" which depends on "archive, javadocs, execute", to do all the tasks.
You could make "all" the default to save typing on the command line.
Not sure if you need/want to run clean as part of "all".

Rob

> -----Original Message-----
> From: VR Venugopal Rao [mailto:venu@cmcltd.com]
> Sent: Monday, August 29, 2011 11:56 PM
> To: 'Ant Users List'
> Subject: RE: Why is the java command not executing
> 
> Hi Robert,
> Thanks for the clarification.
> Does it mean that ant execution does not go sequentially as per the targets
> specified in the build file?
> I mean I have given the following sequence:
> --init
> --compile depends on init
> --javdocs depends on compile
> --archive depends on compile
> --execute depends on archive
> --clean depends on execute
> 
> 
> Regards,
> Venu
> 
> 
> 
> -----Original Message-----
> From: Echlin, Robert [mailto:Robert.Echlin@windriver.com]
> Sent: 29 August 2011 19:25
> To: Ant Users List
> Subject: RE: Why is the java command not executing
> 
> Hi Venu,
> default target is archive
> archive depends on compile, so compile is run.
> compile depends on init, so init is run.
> 
> That's all that is happening, so of course the execute doesn't happen..
> 
> Make archive depends="compile, execute".
> Then it will do
> - init
> - compile
> - execute
> - archive
> 
> Rob
> 
> 
> > -----Original Message-----
> > From: VR Venugopal Rao [mailto:venu@cmcltd.com]
> > Sent: Monday, August 29, 2011 2:38 AM
> > To: 'Ant Users List'
> > Subject: Why is the java command not executing
> >
> > Output:
> >
> > The Build is sucessfuly creating the jar file but not executing the
> > Java file.
> > Any idea why the java is not executing the file.
> > Regards,
> > Venu.
> >
> >
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!--  		packagenames="org.*, de.*, test.*, writer.*"	-->
> > <project name="structured" default="archive" > <target name="init">
> > 	<mkdir dir="build/classes" />
> > 	<mkdir dir="build/classes/docs" />
> > 	<mkdir dir="dist" />
> > 	</target>
> >
> > 	<target name="compile" depends="init" >
> > 		<javac srcdir="src"
> > 		destdir="build/classes"/>
> > 	</target>
> > <target name="javadocs" depends="compile" description="make the java
> > docs" >
> > 	<javadoc author="true"
> > 		destdir="build/classes/docs"
> > 		packagenames="org.*"
> > 		sourcepath="src"
> > 		use="true"
> > 		version="true"
> > 		windowtitle="documentation"
> > 		private="true">
> > 		<classpath refid="compile.classpath"/>
> > 	</javadoc>
> > </target>
> >
> > <target name="archive" depends="compile" >
> > 	<jar destfile="dist/project.jar"
> > 	basedir="build/classes" />
> > </target>
> >
> > <target name="execute" depends="compile">
> > 	<java
> > 	classname="org.example.antbook.lesson1.Main"
> > 	classpath="build/classes">
> > 	<arg value="a"/>
> > 	<arg value="b"/>
> > 	<arg file="."/>
> > 	</java>
> >
> > 	<java
> > 		classname="org.example.antbook.lesson1.HelloWorld"
> > 		classpath="build/classes">
> > 	</java>
> > </target>
> > <target name="clean" depends="execute">
> > 	<delete dir="build" />
> > 	<delete dir="dist" />
> > </target>
> >
> >
> > </project>
> >
> >
> >
> >
> __________________________________________________________
> > ____________________
> >
> > DISCLAIMER
> >
> > The information contained in this e-mail message and/or attachments to
> > it may contain confidential or privileged information. If you are not
> > the intended recipient, any dissemination, use, review, distribution,
> > printing or copying of the information contained in this e-mail
> > message and/or attachments to it are strictly prohibited. If you have
> > received this communication in error, please notify us by reply e-mail
> > or directly to netsupport@cmcltd.com or telephone and immediately and
> > permanently delete the message and any attachments. Thank you.
> >
> >
> __________________________________________________________
> > ____________________
> >
> > This email has been scrubbed for your protection by SecureMX.
> > For more information visit http://securemx.in
> >
> __________________________________________________________
> > ___________________
> >
> > ---------------------------------------------------------------------
> > 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
> 
> 
> 
> __________________________________________________________
> ____________________
> 
> DISCLAIMER
> 
> The information contained in this e-mail message and/or attachments to it
> may
> contain confidential or privileged information. If you are not the intended
> recipient, any dissemination, use, review, distribution, printing or copying
> of the information contained in this e-mail message and/or attachments to it
> are strictly prohibited. If you have received this communication in error,
> please notify us by reply e-mail or directly to netsupport@cmcltd.com or
> telephone and immediately and permanently delete the message and any
> attachments. Thank you.
> 
> __________________________________________________________
> ____________________
> 
> This email has been scrubbed for your protection by SecureMX.
> For more information visit http://securemx.in
> __________________________________________________________
> ___________________
> 
> ---------------------------------------------------------------------
> 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: Why is the java command not executing

Posted by Parag Doke <pa...@gmail.com>.
Hello Venu.
That's right ... ant won't execute targets in the order they appear in
the build.xml file.
Here is the link to the manual:
http://ant.apache.org/manual/targets.html

Hope this helps,
Parag Doke
Save paper, save trees. Do not print emails/documents unless
absolutely necessary.



On Tue, Aug 30, 2011 at 9:25 AM, VR Venugopal Rao <ve...@cmcltd.com> wrote:
> Hi Robert,
> Thanks for the clarification.
> Does it mean that ant execution does not go sequentially as per the targets
> specified in the build file?
> I mean I have given the following sequence:
> --init
> --compile depends on init
> --javdocs depends on compile
> --archive depends on compile
> --execute depends on archive
> --clean depends on execute
>
>
> Regards,
> Venu
>
>
>
> -----Original Message-----
> From: Echlin, Robert [mailto:Robert.Echlin@windriver.com]
> Sent: 29 August 2011 19:25
> To: Ant Users List
> Subject: RE: Why is the java command not executing
>
> Hi Venu,
> default target is archive
> archive depends on compile, so compile is run.
> compile depends on init, so init is run.
>
> That's all that is happening, so of course the execute doesn't happen..
>
> Make archive depends="compile, execute".
> Then it will do
> - init
> - compile
> - execute
> - archive
>
> Rob
>
>
>> -----Original Message-----
>> From: VR Venugopal Rao [mailto:venu@cmcltd.com]
>> Sent: Monday, August 29, 2011 2:38 AM
>> To: 'Ant Users List'
>> Subject: Why is the java command not executing
>>
>> Output:
>>
>> The Build is sucessfuly creating the jar file but not executing the
>> Java file.
>> Any idea why the java is not executing the file.
>> Regards,
>> Venu.
>>
>>
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!--                  packagenames="org.*, de.*, test.*, writer.*"    -->
>> <project name="structured" default="archive" > <target name="init">
>>       <mkdir dir="build/classes" />
>>       <mkdir dir="build/classes/docs" />
>>       <mkdir dir="dist" />
>>       </target>
>>
>>       <target name="compile" depends="init" >
>>               <javac srcdir="src"
>>               destdir="build/classes"/>
>>       </target>
>> <target name="javadocs" depends="compile" description="make the java
>> docs" >
>>       <javadoc author="true"
>>               destdir="build/classes/docs"
>>               packagenames="org.*"
>>               sourcepath="src"
>>               use="true"
>>               version="true"
>>               windowtitle="documentation"
>>               private="true">
>>               <classpath refid="compile.classpath"/>
>>       </javadoc>
>> </target>
>>
>> <target name="archive" depends="compile" >
>>       <jar destfile="dist/project.jar"
>>       basedir="build/classes" />
>> </target>
>>
>> <target name="execute" depends="compile">
>>       <java
>>       classname="org.example.antbook.lesson1.Main"
>>       classpath="build/classes">
>>       <arg value="a"/>
>>       <arg value="b"/>
>>       <arg file="."/>
>>       </java>
>>
>>       <java
>>               classname="org.example.antbook.lesson1.HelloWorld"
>>               classpath="build/classes">
>>       </java>
>> </target>
>> <target name="clean" depends="execute">
>>       <delete dir="build" />
>>       <delete dir="dist" />
>> </target>
>>
>>
>> </project>
>>
>>
>>
>> __________________________________________________________
>> ____________________
>>
>> DISCLAIMER
>>
>> The information contained in this e-mail message and/or attachments to
>> it may contain confidential or privileged information. If you are not
>> the intended recipient, any dissemination, use, review, distribution,
>> printing or copying of the information contained in this e-mail
>> message and/or attachments to it are strictly prohibited. If you have
>> received this communication in error, please notify us by reply e-mail
>> or directly to netsupport@cmcltd.com or telephone and immediately and
>> permanently delete the message and any attachments. Thank you.
>>
>> __________________________________________________________
>> ____________________
>>
>> This email has been scrubbed for your protection by SecureMX.
>> For more information visit http://securemx.in
>> __________________________________________________________
>> ___________________
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
> ______________________________________________________________________________
>
> DISCLAIMER
>
> The information contained in this e-mail message and/or attachments to it may
> contain confidential or privileged information. If you are not the intended
> recipient, any dissemination, use, review, distribution, printing or copying
> of the information contained in this e-mail message and/or attachments to it
> are strictly prohibited. If you have received this communication in error,
> please notify us by reply e-mail or directly to netsupport@cmcltd.com or
> telephone and immediately and permanently delete the message and any
> attachments. Thank you.
>
> ______________________________________________________________________________
>
> This email has been scrubbed for your protection by SecureMX.
> For more information visit http://securemx.in
> _____________________________________________________________________________
>
> ---------------------------------------------------------------------
> 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: Why is the java command not executing

Posted by VR Venugopal Rao <ve...@cmcltd.com>.
Hi Robert,
Thanks for the clarification.
Does it mean that ant execution does not go sequentially as per the targets
specified in the build file?
I mean I have given the following sequence:
--init
--compile depends on init
--javdocs depends on compile
--archive depends on compile
--execute depends on archive
--clean depends on execute


Regards, 
Venu 

 

-----Original Message-----
From: Echlin, Robert [mailto:Robert.Echlin@windriver.com] 
Sent: 29 August 2011 19:25
To: Ant Users List
Subject: RE: Why is the java command not executing

Hi Venu,
default target is archive
archive depends on compile, so compile is run.
compile depends on init, so init is run.

That's all that is happening, so of course the execute doesn't happen..

Make archive depends="compile, execute".
Then it will do
- init
- compile
- execute
- archive

Rob


> -----Original Message-----
> From: VR Venugopal Rao [mailto:venu@cmcltd.com]
> Sent: Monday, August 29, 2011 2:38 AM
> To: 'Ant Users List'
> Subject: Why is the java command not executing
> 
> Output:
> 
> The Build is sucessfuly creating the jar file but not executing the 
> Java file.
> Any idea why the java is not executing the file.
> Regards,
> Venu.
> 
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!--  		packagenames="org.*, de.*, test.*, writer.*"	-->
> <project name="structured" default="archive" > <target name="init">
> 	<mkdir dir="build/classes" />
> 	<mkdir dir="build/classes/docs" />
> 	<mkdir dir="dist" />
> 	</target>
> 
> 	<target name="compile" depends="init" >
> 		<javac srcdir="src"
> 		destdir="build/classes"/>
> 	</target>
> <target name="javadocs" depends="compile" description="make the java 
> docs" >
> 	<javadoc author="true"
> 		destdir="build/classes/docs"
> 		packagenames="org.*"
> 		sourcepath="src"
> 		use="true"
> 		version="true"
> 		windowtitle="documentation"
> 		private="true">
> 		<classpath refid="compile.classpath"/>
> 	</javadoc>
> </target>
> 
> <target name="archive" depends="compile" >
> 	<jar destfile="dist/project.jar"
> 	basedir="build/classes" />
> </target>
> 
> <target name="execute" depends="compile">
> 	<java
> 	classname="org.example.antbook.lesson1.Main"
> 	classpath="build/classes">
> 	<arg value="a"/>
> 	<arg value="b"/>
> 	<arg file="."/>
> 	</java>
> 
> 	<java
> 		classname="org.example.antbook.lesson1.HelloWorld"
> 		classpath="build/classes">
> 	</java>
> </target>
> <target name="clean" depends="execute">
> 	<delete dir="build" />
> 	<delete dir="dist" />
> </target>
> 
> 
> </project>
> 
> 
> 
> __________________________________________________________
> ____________________
> 
> DISCLAIMER
> 
> The information contained in this e-mail message and/or attachments to 
> it may contain confidential or privileged information. If you are not 
> the intended recipient, any dissemination, use, review, distribution, 
> printing or copying of the information contained in this e-mail 
> message and/or attachments to it are strictly prohibited. If you have 
> received this communication in error, please notify us by reply e-mail 
> or directly to netsupport@cmcltd.com or telephone and immediately and 
> permanently delete the message and any attachments. Thank you.
> 
> __________________________________________________________
> ____________________
> 
> This email has been scrubbed for your protection by SecureMX.
> For more information visit http://securemx.in 
> __________________________________________________________
> ___________________
> 
> ---------------------------------------------------------------------
> 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



______________________________________________________________________________

DISCLAIMER

The information contained in this e-mail message and/or attachments to it may
contain confidential or privileged information. If you are not the intended
recipient, any dissemination, use, review, distribution, printing or copying
of the information contained in this e-mail message and/or attachments to it
are strictly prohibited. If you have received this communication in error,
please notify us by reply e-mail or directly to netsupport@cmcltd.com or
telephone and immediately and permanently delete the message and any
attachments. Thank you.

______________________________________________________________________________

This email has been scrubbed for your protection by SecureMX.
For more information visit http://securemx.in
_____________________________________________________________________________

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


RE: Why is the java command not executing

Posted by "Echlin, Robert" <Ro...@windriver.com>.
Hi Venu,
default target is archive
archive depends on compile, so compile is run.
compile depends on init, so init is run.

That's all that is happening, so of course the execute doesn't happen..

Make archive depends="compile, execute".
Then it will do 
- init
- compile
- execute
- archive

Rob


> -----Original Message-----
> From: VR Venugopal Rao [mailto:venu@cmcltd.com]
> Sent: Monday, August 29, 2011 2:38 AM
> To: 'Ant Users List'
> Subject: Why is the java command not executing
> 
> Output:
> 
> The Build is sucessfuly creating the jar file but not executing the Java
> file.
> Any idea why the java is not executing the file.
> Regards,
> Venu.
> 
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!--  		packagenames="org.*, de.*, test.*, writer.*"	-->
> <project name="structured" default="archive" >
> <target name="init">
> 	<mkdir dir="build/classes" />
> 	<mkdir dir="build/classes/docs" />
> 	<mkdir dir="dist" />
> 	</target>
> 
> 	<target name="compile" depends="init" >
> 		<javac srcdir="src"
> 		destdir="build/classes"/>
> 	</target>
> <target name="javadocs" depends="compile" description="make the java
> docs" >
> 	<javadoc author="true"
> 		destdir="build/classes/docs"
> 		packagenames="org.*"
> 		sourcepath="src"
> 		use="true"
> 		version="true"
> 		windowtitle="documentation"
> 		private="true">
> 		<classpath refid="compile.classpath"/>
> 	</javadoc>
> </target>
> 
> <target name="archive" depends="compile" >
> 	<jar destfile="dist/project.jar"
> 	basedir="build/classes" />
> </target>
> 
> <target name="execute" depends="compile">
> 	<java
> 	classname="org.example.antbook.lesson1.Main"
> 	classpath="build/classes">
> 	<arg value="a"/>
> 	<arg value="b"/>
> 	<arg file="."/>
> 	</java>
> 
> 	<java
> 		classname="org.example.antbook.lesson1.HelloWorld"
> 		classpath="build/classes">
> 	</java>
> </target>
> <target name="clean" depends="execute">
> 	<delete dir="build" />
> 	<delete dir="dist" />
> </target>
> 
> 
> </project>
> 
> 
> 
> __________________________________________________________
> ____________________
> 
> DISCLAIMER
> 
> The information contained in this e-mail message and/or attachments to it
> may
> contain confidential or privileged information. If you are not the intended
> recipient, any dissemination, use, review, distribution, printing or copying
> of the information contained in this e-mail message and/or attachments to it
> are strictly prohibited. If you have received this communication in error,
> please notify us by reply e-mail or directly to netsupport@cmcltd.com or
> telephone and immediately and permanently delete the message and any
> attachments. Thank you.
> 
> __________________________________________________________
> ____________________
> 
> This email has been scrubbed for your protection by SecureMX.
> For more information visit http://securemx.in
> __________________________________________________________
> ___________________
> 
> ---------------------------------------------------------------------
> 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