ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Gimler <ggim...@gmail.com>
Subject Re: custom task question
Date Fri, 08 Apr 2005 19:44:33 GMT
Thanks for your help.  I figured it was much too complicated for what
I wanted to do.  The shell script is for a deployment of my software
to various linux pcs.  The software is 24x7 server software for a grid
computing project.  The sysadmins for those pcs are intimately
familiar with unix system v init scripts so that's how I want to
deliver the runtimes to them.

For development and unit testing I always use ant runtimes.  It would
be nicer if I could take those existing runtimes and easily convert
them to shell script form instead of having to maintain them
separately.

Extending the Java task sounds like a much better idea.  I'll see if I
can do that instead.

-Greg


On Apr 8, 2005 3:36 PM, Matt Benson <gudnabrsam@yahoo.com> wrote:
> I would probably do this a different way.  What is the
> shell script for?  What about the particular java task
> in your build file are you trying to preserve?  If you
> really need to do this you'd probably have an easier
> time extending the Java task and grabbing its command
> line to write your shell script... the way you have
> gone about this hooks you into Ant's underpinnings in
> such a way that I couldn't begin to count how many
> things could go wrong.
> 
> -Matt
> 
> --- Greg Gimler <ggimler@gmail.com> wrote:
> > I'm probably doing things incorrectly.
> >
> > The code snippet is...
> >
> > Target target =
> > (Target)getProject().getTargets().get(fromTarget);
> > Task[] tasks = target.getTasks();
> >
> > Then I just search through the array for the one
> > labeled "java" and
> > that turns out to be an UnknownElement.
> >
> > Basically, all I want to do is get a reference to
> > some java task that
> > will allow me to extract the classpath and jvm
> > arguments so I can just
> > output those to a shell script.
> >
> > Thanks for your help.
> >
> > -Greg
> >
> > On Apr 8, 2005 3:01 PM, Matt Benson
> > <gudnabrsam@yahoo.com> wrote:
> > > What code are you executing to return an
> > > UnknownElement?
> > >
> > > -Matt
> > >
> > > --- Greg Gimler <ggimler@gmail.com> wrote:
> > > > Sorry, sent that one too soon.
> > > >
> > > > Continuing... from there I'm trying to get
> > access to
> > > > the java runtime
> > > > inside of the task specified to my custom task,
> > > > unixscriptgen.
> > > > Instead I get access to an UnknownElement which
> > I
> > > > can then try and
> > > > call the getTask() method on.  It returns null
> > > > unless I first call a
> > > > maybeConfigure() on it.  Then I can cast it to a
> > > > Java task but the
> > > > classpath isn't filled.
> > > >
> > > > Any ideas or should I attack this differently?
> > > >
> > > > Thanks.
> > > >
> > > > -Greg
> > > >
> > > >
> > > >
> > > >
> > > > On Apr 8, 2005 2:43 PM, Greg Gimler
> > > > <ggimler@gmail.com> wrote:
> > > > > Hello,
> > > > >
> > > > > I'm trying to generate a unix shell script
> > from an
> > > > ant task.  The ant
> > > > > task is just a simple java execution and I
> > want to
> > > > generate the unix
> > > > > shell script for deployment purposes.  Is
> > there a
> > > > way to do this
> > > > > easily?  I've tried to write a custom task and
> > I'm
> > > > having a difficult
> > > > > time getting all of the information I need.
> > For
> > > > example I have the
> > > > > following snippet...
> > > > >
> > > > > <target name="generate-scripts"
> > > > description="Generates the appropriate
> > > > > shell scripts from ant runtimes.">
> > > > > <taskdef name="unixscriptgen"
> > > > classname="task.UnixScriptGenerator"
> > > > > classpathref="perseus.classpath.run"/>
> > > > >                 <unixscriptgen
> > target="stupidjava"
> > > > file="blah.sh"/>
> > > > >         </target>
> > > > >
> > > > >         <target name="stupidjava"
> > > > description="blah">
> > > > >                 <java
> > > > classname="nonexistantclass">
> > > > >                         <classpath
> > > > refid="perseus.classpath.run"/>
> > > > >                 </java>
> > > > >         </target>
> > > > >
> > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > user-unsubscribe@ant.apache.org
> > > > For additional commands, e-mail:
> > > > user-help@ant.apache.org
> > > >
> > > >
> > >
> > >
> > > __________________________________
> > > Yahoo! Messenger
> > > Show us what our next emoticon should look like.
> > Join the fun.
> > >
> > http://www.advision.webevents.yahoo.com/emoticontest
> > >
> >
> 
> __________________________________
> Yahoo! Messenger
> Show us what our next emoticon should look like. Join the fun.
> http://www.advision.webevents.yahoo.com/emoticontest
>

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


Mime
View raw message