Re: Get Maven's Error Message

2009-06-09 Thread David Nemer
Now I'm trying to use:

InvocationOutputHandler errorHandler = new SystemOutHandler();

invoker.setErrorHandler(errorHandler);

request.getErrorHandler(errorHandler);

But the request.getErrorHandler(errorHandler) is returning:
org.apache.maven.shared.invoker.systemouthand...@4b142196 and not the
error that shows in the Terminal: Error occurred during initialization of
VM java.lang.OutOfMemoryError: unable to create new native thread

Does any one knows how to capture the actual error message that shows up in
the terminal/console?

Cheers,

--
David Nemer
Sent from Kaiserslautern, RP, Germany

On Tue, Jun 9, 2009 at 12:25 AM, David Nemer davidne...@gmail.com wrote:

 Hello All,

 I'm running Maven programatically in Java, so the point is to build the
 projects (run the pom file), so every time a build process fails, I want to
 get this error message! Somehow I can get an error message, for my example,
 it returns: class org.apache.maven.shared.invoker.DefaultInvocationResult
 which is a generic error message, while in the console, there is this error
 message: Error occurred during initialization of VM
 java.lang.OutOfMemoryError: unable to create new native thread And this is
 the error I'm interested in getting (the same as the console/terminal)!

 I'm getting this generic error msg from the result.getClass().toString(),
 I also tried to get an error msg from
 result.getExecutionException().toString() but it always raises Exception
 in thread main java.lang.NullPointerException

 So I was wondering if there is a special method to get the same error msg
 that shows in the terminal (console).

 Here is a peace of my code:

 request.setGoals(Collections.singletonList(install));

 Invoker invoker = new DefaultInvoker();
 File mavenHome = new File(mavenHomePath);

 invoker.setMavenHome(mavenHome);
 InvocationResult result = null;

 request.setProperties(mavenProperty);
 try {
 result = invoker.execute(request);
 } catch (MavenInvocationException e) {

 db.insertBuildData(Integer.toString(revisionNumber), NO,
 e.toString());

 e.printStackTrace();
 }

 if (result.getExitCode() != 0) {

 db.insertBuildData(Integer.toString(revisionNumber), NO,
 result.getClass().toString());
}

 Cheers,
 --
 David Nemer
 Sent from Kaiserslautern, RP, Germany


Re: Get Maven's Error Message

2009-06-09 Thread David Nemer
I was wondering if the SystemOutLogger would help me with the issue...

Thoughts?

Please guys, I'm really stuck here, and I can't seem to pass this issue.

THank you.

--
David Nemer
Sent from Kaiserslautern, RP, Germany

On Tue, Jun 9, 2009 at 4:51 PM, David Nemer davidne...@gmail.com wrote:

 Now I'm trying to use:

 InvocationOutputHandler errorHandler = new SystemOutHandler();

 invoker.setErrorHandler(errorHandler);

 request.getErrorHandler(errorHandler);

 But the request.getErrorHandler(errorHandler) is returning:
 org.apache.maven.shared.invoker.systemouthand...@4b142196 and not the
 error that shows in the Terminal: Error occurred during initialization of
 VM java.lang.OutOfMemoryError: unable to create new native thread

 Does any one knows how to capture the actual error message that shows up in
 the terminal/console?

 Cheers,

 --
 David Nemer
 Sent from Kaiserslautern, RP, Germany

 On Tue, Jun 9, 2009 at 12:25 AM, David Nemer davidne...@gmail.com wrote:

 Hello All,

 I'm running Maven programatically in Java, so the point is to build the
 projects (run the pom file), so every time a build process fails, I want to
 get this error message! Somehow I can get an error message, for my example,
 it returns: class org.apache.maven.shared.invoker.DefaultInvocationResult
 which is a generic error message, while in the console, there is this error
 message: Error occurred during initialization of VM
 java.lang.OutOfMemoryError: unable to create new native thread And this
 is the error I'm interested in getting (the same as the console/terminal)!

 I'm getting this generic error msg from the
 result.getClass().toString(), I also tried to get an error msg from
 result.getExecutionException().toString() but it always raises Exception
 in thread main java.lang.NullPointerException

 So I was wondering if there is a special method to get the same error msg
 that shows in the terminal (console).

 Here is a peace of my code:

 request.setGoals(Collections.singletonList(install));

 Invoker invoker = new DefaultInvoker();
 File mavenHome = new File(mavenHomePath);

 invoker.setMavenHome(mavenHome);
 InvocationResult result = null;

 request.setProperties(mavenProperty);
 try {
 result = invoker.execute(request);
 } catch (MavenInvocationException e) {

 db.insertBuildData(Integer.toString(revisionNumber), NO,
 e.toString());

 e.printStackTrace();
 }

 if (result.getExitCode() != 0) {

 db.insertBuildData(Integer.toString(revisionNumber), NO,
 result.getClass().toString());
}

 Cheers,
 --
 David Nemer
 Sent from Kaiserslautern, RP, Germany





Get Maven's Error Message

2009-06-08 Thread David Nemer
Hello All,

I'm running Maven programatically in Java, so the point is to build the
projects (run the pom file), so every time a build process fails, I want to
get this error message! Somehow I can get an error message, for my example,
it returns: class org.apache.maven.shared.invoker.DefaultInvocationResult
which is a generic error message, while in the console, there is this error
message: Error occurred during initialization of VM
java.lang.OutOfMemoryError: unable to create new native thread And this is
the error I'm interested in getting (the same as the console/terminal)!

I'm getting this generic error msg from the result.getClass().toString(),
I also tried to get an error msg from
result.getExecutionException().toString() but it always raises Exception
in thread main java.lang.NullPointerException

So I was wondering if there is a special method to get the same error msg
that shows in the terminal (console).

Here is a peace of my code:

request.setGoals(Collections.singletonList(install));

Invoker invoker = new DefaultInvoker();
File mavenHome = new File(mavenHomePath);

invoker.setMavenHome(mavenHome);
InvocationResult result = null;

request.setProperties(mavenProperty);
try {
result = invoker.execute(request);
} catch (MavenInvocationException e) {

db.insertBuildData(Integer.toString(revisionNumber), NO,
e.toString());

e.printStackTrace();
}

if (result.getExitCode() != 0) {

db.insertBuildData(Integer.toString(revisionNumber), NO,
result.getClass().toString());
   }

Cheers,
--
David Nemer
Sent from Kaiserslautern, RP, Germany