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

Reply via email to