You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Pasha Minallah <pa...@computer.org> on 2006/03/17 04:13:10 UTC

Running Ant from Cocoon Action

Hi,

I'm trying to run Ant 1.6.2 from a Cocoon 2.1.7 Action.  I've added ant.jar 
and ant-launcher.jar to WEB-INF/lib.

Using org.apache.tools.ant.launch.Launcher in a standalone test case outside 
of cocoon works fine.  It gives me a ClassCastException when I try to use the 
same code inside a cocoon action.  Nothing I have tried gets rid of this 
exception.  Adding the ant jar files to the CLASSPATH environmental variable 
doesn't help.  Defining the extra-classpath parameter in web.xml doesn't 
help.

Using org.apache.tools.ant.Main instead in a standalone test case outside of 
cocoon works also.  It actually works from the cocoon action BUT it kills 
cocoon.

Any hints?

I could try to use org.apache.tools.ant.Main in a separate thread but that 
doesn't make sense because we need the logic to be synchronous.

Thanks.

- Pasha

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Running Ant from Cocoon Action

Posted by Upayavira <uv...@odoko.co.uk>.
Pasha Minallah wrote:
> Hi,
> 
> I'm trying to run Ant 1.6.2 from a Cocoon 2.1.7 Action.  I've added ant.jar 
> and ant-launcher.jar to WEB-INF/lib.
> 
> Using org.apache.tools.ant.launch.Launcher in a standalone test case outside 
> of cocoon works fine.  It gives me a ClassCastException when I try to use the 
> same code inside a cocoon action.  Nothing I have tried gets rid of this 
> exception.  Adding the ant jar files to the CLASSPATH environmental variable 
> doesn't help.  Defining the extra-classpath parameter in web.xml doesn't 
> help.
> 
> Using org.apache.tools.ant.Main instead in a standalone test case outside of 
> cocoon works also.  It actually works from the cocoon action BUT it kills 
> cocoon.
> 
> Any hints?

Sounds like something is calling System.exit(), which would be
acceptable for a command line tool. Get the source of the version of ant
you're using and have a look. Maybe you could call the stuff that Main
is calling, rather than using Main directly.

Also, you should ask on the Ant user list about programmatic interfaces
to Ant - they're better people to ask.

> I could try to use org.apache.tools.ant.Main in a separate thread but that 
> doesn't make sense because we need the logic to be synchronous.

System.exit() would still kill it even in a different thread!

Regards, Upayavira


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Running Ant from Cocoon Action

Posted by Antonio Gallardo <ag...@agssa.net>.
Hi Pasha,

Maybe this helps [1].

Best Regards,

Antonio Gallardo

[1] http://ant.apache.org/manual/antexternal.html

Pasha Minallah wrote:

>Hi,
>
>I'm trying to run Ant 1.6.2 from a Cocoon 2.1.7 Action.  I've added ant.jar 
>and ant-launcher.jar to WEB-INF/lib.
>
>Using org.apache.tools.ant.launch.Launcher in a standalone test case outside 
>of cocoon works fine.  It gives me a ClassCastException when I try to use the 
>same code inside a cocoon action.  Nothing I have tried gets rid of this 
>exception.  Adding the ant jar files to the CLASSPATH environmental variable 
>doesn't help.  Defining the extra-classpath parameter in web.xml doesn't 
>help.
>
>Using org.apache.tools.ant.Main instead in a standalone test case outside of 
>cocoon works also.  It actually works from the cocoon action BUT it kills 
>cocoon.
>
>Any hints?
>
>I could try to use org.apache.tools.ant.Main in a separate thread but that 
>doesn't make sense because we need the logic to be synchronous.
>
>Thanks.
>
>- Pasha
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org