You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Michael Giroux <ml...@gmail.com> on 2005/12/06 16:17:39 UTC

How to use ANT as a command shell

I'm attempting to develop platform neutral launch scripts using ANT.  The
product currently has bin/nt and bin/unix folders with shell scripts
specific to each platform.  I would like to replace this with a single bin
folder containing ant scripts.

The main issue is that ANT treats command line args as target names.

Is there any way to cause ANT to
1) always invoke the default target
2) make the command line args available as a set of properties or some form
of enumeration

Michael Giroux

Re: How to use ANT as a command shell

Posted by Steve Loughran <st...@apache.org>.
Antoine Levy-Lambert wrote:
> Steve Loughran wrote:
> 
> 
>>While I agree with everything in this doc, it shows the pent-up demand
>>for a decent command-line app launcher from Java, above and beyond the
>>classic "java -jar somejar args" technique.
>>
>>If/when we refactor Ant's <exec>/<java> logic into a jakarta-commons
>>project (the maven people, amongst others), would like this, we could
>>have a special command line launcher that takes a manifest file and
>>automatically runs the program. Smartfrog can do this, but it is
>>focused on long-lived deployments, not command line stuff, and we
>>believe that all parameters should be encoded in deployment
>>descriptors, preferably under SCM. Here, for example is the descriptor
>>to pull down and deploy axis1.1's TCP monitor, using the maven2
>>library to allow dynamic download. Did I mention that dynamic download
>>of authenticated JAR files should be a feature of the command line
>>launcher ?
>>
>>-steve
>>
> 
> Hello Steve,
> 
> would you want to make ant dependent upon a jakarta-commons library ?
> 
> or would you want to copy the code of <java/> and <exec/> elsewhere ?
> 
> Until recently the common ant wisdom was that we wanted to depend only
> upon the JDK and the XML parser.

no, it wouldnt be like that. We'd somehow export the bits of the runtime 
to configure and run programs as a commons-lib, repackaging them to 
isolate ourselves from version grief.



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


Re: How to use ANT as a command shell

Posted by Antoine Levy-Lambert <an...@gmx.de>.
Steve Loughran wrote:

> While I agree with everything in this doc, it shows the pent-up demand
> for a decent command-line app launcher from Java, above and beyond the
> classic "java -jar somejar args" technique.
>
> If/when we refactor Ant's <exec>/<java> logic into a jakarta-commons
> project (the maven people, amongst others), would like this, we could
> have a special command line launcher that takes a manifest file and
> automatically runs the program. Smartfrog can do this, but it is
> focused on long-lived deployments, not command line stuff, and we
> believe that all parameters should be encoded in deployment
> descriptors, preferably under SCM. Here, for example is the descriptor
> to pull down and deploy axis1.1's TCP monitor, using the maven2
> library to allow dynamic download. Did I mention that dynamic download
> of authenticated JAR files should be a feature of the command line
> launcher ?
>
> -steve
>
Hello Steve,

would you want to make ant dependent upon a jakarta-commons library ?

or would you want to copy the code of <java/> and <exec/> elsewhere ?

Until recently the common ant wisdom was that we wanted to depend only
upon the JDK and the XML parser.

Cheers,

Antoine

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


Re: How to use ANT as a command shell

Posted by Steve Loughran <st...@apache.org>.
Jeffrey E Care wrote:
> Ant is not intended to be used in this way. The fact that you can kind of 
> hack it together to work should not be taken as encouragement to do so.
> 
> You might want to read "Ant in Anger" 
> (http://ant.apache.org/ant_in_anger.html) before setting yourself on this 
> course.
> 
> JEC

While I agree with everything in this doc, it shows the pent-up demand 
for a decent command-line app launcher from Java, above and beyond the 
classic "java -jar somejar args" technique.

If/when we refactor Ant's <exec>/<java> logic into a jakarta-commons 
project (the maven people, amongst others), would like this, we could 
have a special command line launcher that takes a manifest file and 
automatically runs the program. Smartfrog can do this, but it is focused 
on long-lived deployments, not command line stuff, and we believe that 
all parameters should be encoded in deployment descriptors, preferably 
under SCM. Here, for example is the descriptor to pull down and deploy 
axis1.1's TCP monitor, using the maven2 library to allow dynamic 
download. Did I mention that dynamic download of authenticated JAR files 
should be a feature of the command line launcher ?

-steve


sfConfig extends Compound {

     library extends Maven2Library {
     }

     commons-logging extends JarArtifact {
         library LAZY PARENT:library;
         project "commons-logging";
         version "1.0.4";
         sha1 "f029a2aefe2b3e1517573c580f948caac31b1056";
         md5 "8a507817b28077e0478add944c64586a";
     }

     axis extends JarArtifact {
         library LAZY PARENT:library;
         project "axis";
         artifact "axis";
         version "1.1";
         sha1 "edd84c96eac48d4167bca4f45e7d36dcf36cf871";
     }


     tcpmonitor extends Java {
         classname "org.apache.axis.utils.tcpmon";
         classpath [
             LAZY axis:absolutePath,
             LAZY commons-logging:absolutePath];
     }

}


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


Re: How to use ANT as a command shell

Posted by Jeffrey E Care <ca...@us.ibm.com>.
Ant is not intended to be used in this way. The fact that you can kind of 
hack it together to work should not be taken as encouragement to do so.

You might want to read "Ant in Anger" 
(http://ant.apache.org/ant_in_anger.html) before setting yourself on this 
course.

JEC
-- 
Jeffrey E. Care (carej@us.ibm.com)
WebSphere v7 Release Engineer
WebSphere Build Tooling Lead (Project Mantis)


Michael Giroux <ml...@gmail.com> wrote on 12/06/2005 10:17:39 AM:

> I'm attempting to develop platform neutral launch scripts using ANT. The
> product currently has bin/nt and bin/unix folders with shell scripts
> specific to each platform.  I would like to replace this with a single 
bin
> folder containing ant scripts.
> 
> The main issue is that ANT treats command line args as target names.
> 
> Is there any way to cause ANT to
> 1) always invoke the default target
> 2) make the command line args available as a set of properties or some 
form
> of enumeration
> 
> Michael Giroux