You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Joshua Kneubuhl <jo...@demandtec.com> on 2002/04/25 04:12:15 UTC

Help generating scripts from ant tasks

Hi everyone,

I have a set of ant tasks which use the <exec> and <java> tasks to invoke several programs.  This is fine for a development environment, but for a production environment its NOT acceptable to run these programs forked from ant.

I've had good luck using ant -verbose to print command-line versions of whatever ant exec's, then copy and paste these into startup scripts.  

But...  I'd like to automate this using an ant task-  that way my "release" target can generate startup scripts that are equivalent to the setup of <classpath>, environment, command-line, etc... elements in my build.xml.

Can anyone suggest a strategy to accomplish this?  

I'm considering subclassing the ExecTask--  sortof like this:

	<classpath refid="class.path">
		<pathelement location="${deploy.dir}/foo.jar"/>
		<pathelement location="${deploy.dir}/bar.jar"/>
	</classpath>

	<target name="run-foo-server" depends="deploy">
		<java dir="${deploy.dir}/bin" classname="my.class">
			<arg value="arg1"/>
			<classpath refid="class.path"/>
		</java>
	</target>

	<target name="make-foo-server-script" depends="deploy">
		<java-script-generator dir="${deploy.dir}/bin" classname="my.class">
			<arg value="arg1"/>
			<classpath refid="class.path"/>
		</java>
	</target>


Where java-script-generator is a user-defined task that extends the ExecTask (or ExecuteJava), and writes the Execute object into an OS-specific shell script.


Is there something simpler to try? 

Cheers
josh

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: - Password protecting files in a Zip

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 25 Apr 2002, Vikram Kulkarni <vk...@icope.com> wrote:

> and looks like adding password protected files isn't supported.

True.

> Is there any way of doing this?

<exec>ing the native zip command is the only chance I see ATM.

> Can this feature be included in the <zip> task?

Possible - if somebody supplies the necessary patches 8-)

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


- Password protecting files in a Zip

Posted by Vikram Kulkarni <vk...@icope.com>.
Hi Ant Users!
I need to create a zip having password protected files. I checked out the
docs(1.4) and looks like adding password protected files isn't supported.

Is there any way of doing this?
Can this feature be included in the <zip> task?

Thanks,
Vikram Kulkarni
www.icope.com



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: HELP PLEASE.Having trouble getting sources with ant from CVS server

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 25 Apr 2002, <sa...@grandsphere.com> wrote:
>   <cvs cvsRoot="cvs -d :pserver:sato@172.19.50.207:/usr/local/cvsroot login"

the cvsroot is ":pserver:sato@172.19.50.207:/usr/local/cvsroot",
nothing else.

>   command="password=sato"

Nope, command would be "login" in that case, but login is interactive,
that's why I said you'd have to use your command line (and not Ant) or
the <cvspass> task.

Please consult your cvs manual.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: HELP PLEASE.Having trouble getting sources with ant from CVS server

Posted by sato <sa...@grandsphere.com>.
thank you Stefan,
I got this message , what is it supposed to mean?
I fixed my source something like this..
###
  <cvs cvsRoot="cvs -d :pserver:sato@172.19.50.207:/usr/local/cvsroot login"
       command="password=sato"
       package="source
       dest="PROJECT1"
  />
  <cvs cvsRoot="cvs -d :pserver:sato@172.19.50.207:/usr/local/cvsroot co
PACKAGE"
       package="PROJECT1"
  />
###

but I get this message. It seems that I could log in CVS but I could not get
sources.

Here is the message I got:
[cvs] cvs [checkout aborted]: end of file from server (consult above
messages if any)




----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Thursday, April 25, 2002 3:57 PM
Subject: Re: HELP PLEASE.Having trouble getting sources with ant from CVS
server


> On Thu, 25 Apr 2002, <sa...@grandsphere.com> wrote:
>
> > It says on the website "I have to get my password in .cvspass in my
> > home directory.
>
> Exactly, but not in plain text.
>
> Either use
>
> cvs -d :pserver:USERNAME@172.19.50.207:/usr/local/cvsroot login
>
> on the command line and enter the password or use the <cvspass> task.
> If you never use cvs logout, you will only have to do that once.
>
> Stefan
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: HELP PLEASE.Having trouble getting sources with ant from CVS server

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 25 Apr 2002, <sa...@grandsphere.com> wrote:

> It says on the website "I have to get my password in .cvspass in my
> home directory.

Exactly, but not in plain text.

Either use 

cvs -d :pserver:USERNAME@172.19.50.207:/usr/local/cvsroot login

on the command line and enter the password or use the <cvspass> task.
If you never use cvs logout, you will only have to do that once.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


HELP PLEASE.Having trouble getting sources with ant from CVS server

Posted by sato <sa...@grandsphere.com>.
Hey , everybody
I am trying to set up build.xml in order to get source from cvs repository
(that is a different machine)
but I could not quite get it.
It says on the website "I have to get my password in .cvspass in my home
directory.
But I get error code which says,

    [cvs] cvs [update aborted]: use "cvs login" to log in first

Here is build.xml source I put in there.
<cvs cvsRoot=":pserver:USERNAME@172.19.50.207:/usr/local/cvsroot"
       command="update"
       package="PACKAGE/PROJECT1"
       dest="PROJECT1"
   />

thank you.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Help generating scripts from ant tasks

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 24 Apr 2002, Joshua Kneubuhl <jo...@demandtec.com>
wrote:

> Where java-script-generator is a user-defined task that extends the
> ExecTask (or ExecuteJava), and writes the Execute object into an
> OS-specific shell script.

Don't use ExecTask as your starting point but look at Commandline
directly.

BTW, the command line you see with -verbose is not really what Ant
executes, only an approximation of it (we should fix that IMHO).  Ant
doesn't use a command line with arguments that are quoted to preserve
whitespace in them, it uses the String[] version of Runtime.exec which
means every single command line argument gets passed as an unquoted
String.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>