ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Kneubuhl" <joshua.kneub...@demandtec.com>
Subject Help generating scripts from ant tasks
Date Thu, 25 Apr 2002 02:12:15 GMT
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:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message