Basic question about ant

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Basic question about ant

veena pandit
Hi,

I am a newbie to Ant.
I got the following from a tutorial and tried to add it to my existing
project:

<project default="wsgen"
    <target name = "wsgen">
    <exec executable="wsgen">
       <arg line="-cp ./bin -keep -s ./src -d
com.tutorial.wsServer.SayHello/>
    </exec
   </target>
</project>

I get:

Cannot run program "wsgen":CreateProcess error=2. The system cannot find the
path specified.

Any suggestions?
Reply | Threaded
Open this post in threaded view
|

Re: Basic question about ant

Dominique Devienne-2
On Fri, Aug 28, 2009 at 12:53 PM, veena pandit<[hidden email]> wrote:
>    <exec executable="wsgen">
>       <arg line="-cp ./bin -keep -s ./src -d
> com.tutorial.wsServer.SayHello/>
>    </exec
>
> Cannot run program "wsgen":CreateProcess error=2. The system cannot find the
> path specified.

This means wsgen in not in your path. If you can't run it at the command line,
you can't run it inside Ant.

Note that it's also best to use <arg value=""> and <arg file=""> rather than
a single <arg file="">, as <arg file=""> will convert them to absolute filenames
and use the proper file separator depending on the current platform. --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Basic question about ant

veena pandit
Hi,

I added it to the environment variable of path;  i still cant run ant from
the command line.  I am getting this error
while running it from eclipse.

What am I doing wrong?

Thanks in advance,

Veena

On Fri, Aug 28, 2009 at 2:45 PM, Dominique Devienne <[hidden email]>wrote:

> On Fri, Aug 28, 2009 at 12:53 PM, veena pandit<[hidden email]> wrote:
> >    <exec executable="wsgen">
> >       <arg line="-cp ./bin -keep -s ./src -d
> > com.tutorial.wsServer.SayHello/>
> >    </exec
> >
> > Cannot run program "wsgen":CreateProcess error=2. The system cannot find
> the
> > path specified.
>
> This means wsgen in not in your path. If you can't run it at the command
> line,
> you can't run it inside Ant.
>
> Note that it's also best to use <arg value=""> and <arg file=""> rather
> than
> a single <arg file="">, as <arg file=""> will convert them to absolute
> filenames
> and use the proper file separator depending on the current platform. --DD
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Basic question about ant

Dominique Devienne-2
On Fri, Aug 28, 2009 at 2:00 PM, veena pandit<[hidden email]> wrote:
> I added it to the environment variable of path;  i still cant run ant from
> the command line.  I am getting this error
> while running it from eclipse.
>
> What am I doing wrong?

Sorry, I'm not an IDE user, I can't help you there. --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Basic question about ant

veena pandit
Well,  I wonder why I cant run ant from the command line. Even though the
path is set.
  Do I have to set classpath as well?
On Fri, Aug 28, 2009 at 3:32 PM, Dominique Devienne <[hidden email]>wrote:

> On Fri, Aug 28, 2009 at 2:00 PM, veena pandit<[hidden email]> wrote:
> > I added it to the environment variable of path;  i still cant run ant
> from
> > the command line.  I am getting this error
> > while running it from eclipse.
> >
> > What am I doing wrong?
>
> Sorry, I'm not an IDE user, I can't help you there. --DD
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Basic question about ant

Gilbert Rebhan
veena pandit schrieb:
> Well,  I wonder why I cant run ant from the command line. Even though the
> path is set.
>   Do I have to set classpath as well?

i assume your're on windows ..

ant installation in general =

set ANT_HOME=path/to/root/of/your/antinstalldirectory
set PATH=%PATH%;%ANT_HOME%/bin
also take care of addon /extra tasks, see =
http://marc.info/?l=ant-user&m=124959044401518&w=2

then open up a shell and =
C:\>ant
Buildfile: build.xml does not exist!
Build failed

OK :-)

ant + eclipse =
to make addon tasks work in eclipse :
Window | Preferences | Ant | Runtime | Global Entries | Add Jars

you may adjust the environment to your needs via focus on main target in
outline window, right mouse and choose 3 Ant Build not 2 Ant Build
Shift+Alt X Q and you'll get a new window where args, classpath,
environment may be altered

another possibility in your special case, means accessing
an executable not on path, just use the whole path, means =

project:

<project default="wsgen"
    <target name = "wsgen">
    <exec executable="the/whole/path/to/wsgen">
       <arg line="...
...



Regards, Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

AW: Basic question about ant

Jan.Materne
I put a note in the manual.
rev 809463

Jan

> -----Ursprüngliche Nachricht-----
> Von: Gilbert Rebhan [mailto:[hidden email]]
> Gesendet: Freitag, 28. August 2009 23:12
> An: Ant Users List
> Betreff: Re: Basic question about ant
>
> veena pandit schrieb:
> > Well,  I wonder why I cant run ant from the command line.
> Even though the
> > path is set.
> >   Do I have to set classpath as well?
>
> i assume your're on windows ..
>
> ant installation in general =
>
> set ANT_HOME=path/to/root/of/your/antinstalldirectory
> set PATH=%PATH%;%ANT_HOME%/bin
> also take care of addon /extra tasks, see =
> http://marc.info/?l=ant-user&m=124959044401518&w=2
>
> then open up a shell and =
> C:\>ant
> Buildfile: build.xml does not exist!
> Build failed
>
> OK :-)
>
> ant + eclipse =
> to make addon tasks work in eclipse :
> Window | Preferences | Ant | Runtime | Global Entries | Add Jars
>
> you may adjust the environment to your needs via focus on
> main target in
> outline window, right mouse and choose 3 Ant Build not 2 Ant Build
> Shift+Alt X Q and you'll get a new window where args, classpath,
> environment may be altered
>
> another possibility in your special case, means accessing
> an executable not on path, just use the whole path, means =
>
> project:
>
> <project default="wsgen"
>     <target name = "wsgen">
>     <exec executable="the/whole/path/to/wsgen">
>        <arg line="...
> ...
>
>
>
> Regards, Gilbert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Basic question about ant

veena pandit
In reply to this post by Gilbert Rebhan
Hi,

I was able to fix the environment variable and run ant from the command
line.  I tried the things you listed below but from eclipse it still gives
me an error saying it does not recognize the program wsgen.

Thanks,

Veena
On Fri, Aug 28, 2009 at 5:12 PM, Gilbert Rebhan <[hidden email]> wrote:

> veena pandit schrieb:
> > Well,  I wonder why I cant run ant from the command line. Even though the
> > path is set.
> >   Do I have to set classpath as well?
>
> i assume your're on windows ..
>
> ant installation in general =
>
> set ANT_HOME=path/to/root/of/your/antinstalldirectory
> set PATH=%PATH%;%ANT_HOME%/bin
> also take care of addon /extra tasks, see =
> http://marc.info/?l=ant-user&m=124959044401518&w=2
>
> then open up a shell and =
> C:\>ant
> Buildfile: build.xml does not exist!
> Build failed
>
> OK :-)
>
> ant + eclipse =
> to make addon tasks work in eclipse :
> Window | Preferences | Ant | Runtime | Global Entries | Add Jars
>
> you may adjust the environment to your needs via focus on main target in
> outline window, right mouse and choose 3 Ant Build not 2 Ant Build
> Shift+Alt X Q and you'll get a new window where args, classpath,
> environment may be altered
>
> another possibility in your special case, means accessing
> an executable not on path, just use the whole path, means =
>
> project:
>
> <project default="wsgen"
>    <target name = "wsgen">
>    <exec executable="the/whole/path/to/wsgen">
>       <arg line="...
> ...
>
>
>
> Regards, Gilbert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Basic question about ant

Gilbert Rebhan
veena pandit schrieb:
> Hi,
>
> I was able to fix the environment variable and run ant from the command
> line.  I tried the things you listed below but from eclipse it still gives
> me an error saying it does not recognize the program wsgen.
>

did you try the absolute path, f.e.

...
<exec executable="C:/whatever/path/to/wsgen">
...

??

gives us a snippet with your latest try



Regards, Gilbert


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Basic question about ant

veena pandit
Since wsgen is in a jar file,  I put the complete path of the jar file in
the exec.
So if anttasks.jar was in C:/eclipse/plugins/anttasks.jar then my exec looks
like this:

<exec executable="C:/eclipse/plugins/wsgen">

On Mon, Aug 31, 2009 at 1:01 PM, Gilbert Rebhan <[hidden email]> wrote:

> veena pandit schrieb:
> > Hi,
> >
> > I was able to fix the environment variable and run ant from the command
> > line.  I tried the things you listed below but from eclipse it still
> gives
> > me an error saying it does not recognize the program wsgen.
> >
>
> did you try the absolute path, f.e.
>
> ...
> <exec executable="C:/whatever/path/to/wsgen">
> ...
>
> ??
>
> gives us a snippet with your latest try
>
>
>
> Regards, Gilbert
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

RE: Basic question about ant

mgainty

you'll want try to locate the main class of the jar

cd SomeFolder
jar -xvf wsgen.jar

cd SomeFolder
javap *.class | grep main

//when you see a 'main' method in one of the classes
//then assign the main class to classname attribute of taskdef as described here
<taskdef name="global"
           classname="package.ClassWithMain">
    <classpath refid="testclasses" />
  </taskdef>

//now you can call the task from a target
<target name="testGlobal">
    <global>
      <echo message="it worked!" />
    </global>
  </target>

Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Mon, 31 Aug 2009 18:47:02 -0400
> Subject: Re: Basic question about ant
> From: [hidden email]
> To: [hidden email]
>
> Since wsgen is in a jar file,  I put the complete path of the jar file in
> the exec.
> So if anttasks.jar was in C:/eclipse/plugins/anttasks.jar then my exec looks
> like this:
>
> <exec executable="C:/eclipse/plugins/wsgen">
>
> On Mon, Aug 31, 2009 at 1:01 PM, Gilbert Rebhan <[hidden email]> wrote:
>
> > veena pandit schrieb:
> > > Hi,
> > >
> > > I was able to fix the environment variable and run ant from the command
> > > line.  I tried the things you listed below but from eclipse it still
> > gives
> > > me an error saying it does not recognize the program wsgen.
> > >
> >
> > did you try the absolute path, f.e.
> >
> > ...
> > <exec executable="C:/whatever/path/to/wsgen">
> > ...
> >
> > ??
> >
> > gives us a snippet with your latest try
> >
> >
> >
> > Regards, Gilbert
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >

_________________________________________________________________
Windows Live: Keep your friends up to date with what you do online.
http://windowslive.com/Campaign/SocialNetworking?ocid=PID23285::T:WLMTAGL:ON:WL:en-US:SI_SB_online:082009
Reply | Threaded
Open this post in threaded view
|

RE: Basic question about ant

Rebhan, Gilbert
In reply to this post by veena pandit
 

-----Original Message-----
From: veena pandit [mailto:[hidden email]]
Sent: Tuesday, September 01, 2009 12:47 AM
To: Ant Users List
Subject: Re: Basic question about ant

/*
Since wsgen is in a jar file,  I put the complete path of the jar file in
the exec.
So if anttasks.jar was in C:/eclipse/plugins/anttasks.jar then my exec looks
like this:

<exec executable="C:/eclipse/plugins/wsgen">
*/

since your wsgen task comes with a jar, don't use the exec task,
but i should be as easy as =

use taskdef with path =
  <taskdef resource="com.whatever.wsgen.TheClassYouNeedToCall">
    <classpath path="C:/wsgen/wsgentask.jar" />
  </taskdef>

or if it's a tasksuite where wsgen is part of =
use taskdef with path =
  <taskdef resource="com/whatever/antlib.xml">
    <classpath path="C:/wsgen/wstasks.jar" />
  </taskdef>


add the wsgentask.jar to the (eclipse) antruntime via
Window | Preferences | Ant | Runtime | Global Entries |
 and either
   Add Jars if you have a project in your workspace
   that contains your wsgentask.jar (personally i prefer to
    have a simple project named DevJars in my workspace
    which has all the jars i need, which is also under cvs control)
   or
   Add External Jars to use a wsgentask.jar that lives
   in filesytem outside eclkipse workspace

you will also have code assist for your tasks in ant editor then

when put to ant runtime you don't need the nested classpath =
<taskdef resource="com.whatever.wsgen.TheClassYouNeedToCall"/>
or
<taskdef resource="com/whatever/antlib.xml"/>


Regards, Gilbert




 

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Basic question about ant

veena pandit
* I tried build again and wsgen works.  I haven't done any of the steps
below.*
*This is after I added ant to the path.  and set ANT_HOME yesterday.*
*Today wsgen works.*

**
Thanks to all the people who helped.

Veena


On Tue, Sep 1, 2009 at 3:44 AM, Rebhan, Gilbert <
[hidden email]> wrote:

>
>
> -----Original Message-----
> From: veena pandit [mailto:[hidden email]]
> Sent: Tuesday, September 01, 2009 12:47 AM
> To: Ant Users List
> Subject: Re: Basic question about ant
>
> /*
> Since wsgen is in a jar file,  I put the complete path of the jar file in
> the exec.
> So if anttasks.jar was in C:/eclipse/plugins/anttasks.jar then my exec
> looks
> like this:
>
> <exec executable="C:/eclipse/plugins/wsgen">
> */
>
> since your wsgen task comes with a jar, don't use the exec task,
> but i should be as easy as =
>
> use taskdef with path =
>  <taskdef resource="com.whatever.wsgen.TheClassYouNeedToCall">
>    <classpath path="C:/wsgen/wsgentask.jar" />
>  </taskdef>
>
> or if it's a tasksuite where wsgen is part of =
> use taskdef with path =
>  <taskdef resource="com/whatever/antlib.xml">
>    <classpath path="C:/wsgen/wstasks.jar" />
>  </taskdef>
>
>
> add the wsgentask.jar to the (eclipse) antruntime via
> Window | Preferences | Ant | Runtime | Global Entries |
>  and either
>   Add Jars if you have a project in your workspace
>   that contains your wsgentask.jar (personally i prefer to
>    have a simple project named DevJars in my workspace
>    which has all the jars i need, which is also under cvs control)
>   or
>   Add External Jars to use a wsgentask.jar that lives
>   in filesytem outside eclkipse workspace
>
> you will also have code assist for your tasks in ant editor then
>
> when put to ant runtime you don't need the nested classpath =
> <taskdef resource="com.whatever.wsgen.TheClassYouNeedToCall"/>
> or
> <taskdef resource="com/whatever/antlib.xml"/>
>
>
> Regards, Gilbert
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>