You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Wendell Beckwith <wb...@gmail.com> on 2005/09/21 05:20:21 UTC

[m2] How to get logging from commons-exec?

I checked out the source for commons-exec and built the
commons-exec-1.0-SNAPSHOT.jar. I added this jar as a dependency to my m2
plugin project and wrote a simple Foo app to verify that everything was
working. The app just writes the current time into a file and all is well
with this. What's missing is how to tie the output from my process into the
currently executing maven process. Below is my mojo's execute method. None
of the unit tests actually demonstrate how to configure the current process
to receive logging from a sub-process.


public void execute() throws MojoExecutionException
{
CommandLine cl = new CommandLineImpl();
cl.setExecutable("java");
cl.addArgument("-classpath");
cl.addArgument("D:/dev/workspace/maven-hello-plugin/bin");
cl.addArgument("com.mycompany.maven.plugins.Foo");
try
{
Exec exec = new Exec();
exec.execute(cl);
}
catch (IOException e)
{
throw new MojoExecutionException(e);
}
}


Wb

Re: [m2] How to get logging from commons-exec?

Posted by Wendell Beckwith <wb...@gmail.com>.
Actually because it was dev/users on this list telling me to use
commons-exec and because I see Brett all over the checkin logs that I
assumed this was the correct forum to ask my question. Now in reference to
your email from yesterday, I did follow the link, but that reference you
pointed me to writes it's stdin/stderr to a file. I just need to tie the
sub-processes output to my current maven process's output and I'm pretty
much done with my plugin outside of enhanced error checking and documenting
it. Personally, I'm not tied to any specific API, if plexus-utils will do
what I need/want then that's great. I just want to know how to get the
streams together. Any other pointers/example that will help in this matter?

Wb


On 9/21/05, Trygve Laugstøl <tr...@codehaus.org> wrote:
>
> On Tue, 2005-09-20 at 22:20 -0500, Wendell Beckwith wrote:
> > I checked out the source for commons-exec and built the
> > commons-exec-1.0-SNAPSHOT.jar. I added this jar as a dependency to my m2
> > plugin project and wrote a simple Foo app to verify that everything was
> > working. The app just writes the current time into a file and all is
> well
> > with this. What's missing is how to tie the output from my process into
> the
> > currently executing maven process. Below is my mojo's execute method.
> None
> > of the unit tests actually demonstrate how to configure the current
> process
> > to receive logging from a sub-process.
>
> First, this is not the right forum for these questions, please ask new
> questions on commons-dev@jakarta.apache.org.
>
> commons-exec is not ready for prime-time yet, so currently I would
> suggest that you use plexus-utils and the cli methods that's in there. I
> will sometime this week apply the outstanding patches for commons-exec
> and try to make it more useful but it's not there yet.
>
> For a usage example please see the other mail I wrote yesterday.
>
> --
> Trygve
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: [m2] How to get logging from commons-exec?

Posted by Trygve Laugstøl <tr...@codehaus.org>.
On Tue, 2005-09-20 at 22:20 -0500, Wendell Beckwith wrote:
> I checked out the source for commons-exec and built the
> commons-exec-1.0-SNAPSHOT.jar. I added this jar as a dependency to my m2
> plugin project and wrote a simple Foo app to verify that everything was
> working. The app just writes the current time into a file and all is well
> with this. What's missing is how to tie the output from my process into the
> currently executing maven process. Below is my mojo's execute method. None
> of the unit tests actually demonstrate how to configure the current process
> to receive logging from a sub-process.

First, this is not the right forum for these questions, please ask new
questions on commons-dev@jakarta.apache.org. 

commons-exec is not ready for prime-time yet, so currently I would
suggest that you use plexus-utils and the cli methods that's in there. I
will sometime this week apply the outstanding patches for commons-exec
and try to make it more useful but it's not there yet.

For a usage example please see the other mail I wrote yesterday.

--
Trygve



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