Build fails if Java not in system path
--------------------------------------

                 Key: MCOBERTURA-72
                 URL: http://jira.codehaus.org/browse/MCOBERTURA-72
             Project: Maven 2.x Cobertura Plugin
          Issue Type: Bug
    Affects Versions: 2.0
         Environment: Ubuntu Linux.  Multiple JDKs installed in 
/home/scorwin/apps/java, $JAVA_HOME set to control which one is used.
            Reporter: Steve Corwin


The build fails if the java executable is not in the system path.   The 
complete stacktrace is below.  The line "java.io.IOException: java: not found" 
lead me to bug MCOBERTURA-49, which appears to be the same problem except on a 
Windows system.

After reading MCOBERTURA-49,  I created a successful workaround: I created a 
file /usr/local/bin/java, which only  needs to contain one line:
$JAVA_HOME/bin/java $*
and of course needs to be marked as executable.  With this assistance the 
exception goes away and the build is able to run to completion.

Failure output:
[INFO] [cobertura:instrument]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Unable to execute Cobertura.

Embedded error: Error while executing process.
java.io.IOException: java: not found
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Unable to execute 
Cobertura.
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:896)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:739)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:510)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to execute 
Cobertura.
        at 
org.codehaus.mojo.cobertura.tasks.AbstractTask.executeJava(AbstractTask.java:185)
        at 
org.codehaus.mojo.cobertura.tasks.InstrumentTask.execute(InstrumentTask.java:122)
        at 
org.codehaus.mojo.cobertura.CoberturaInstrumentMojo.execute(CoberturaInstrumentMojo.java:110)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
        ... 20 more
Caused by: org.codehaus.plexus.util.cli.CommandLineException: Error while 
executing process.
        at 
org.codehaus.plexus.util.cli.Commandline.execute(Commandline.java:697)
        at 
org.codehaus.plexus.util.cli.CommandLineUtils.executeCommandLine(CommandLineUtils.java:74)
        at 
org.codehaus.plexus.util.cli.CommandLineUtils.executeCommandLine(CommandLineUtils.java:60)
        at 
org.codehaus.mojo.cobertura.tasks.AbstractTask.executeJava(AbstractTask.java:181)
        ... 24 more
Caused by: java.io.IOException: java.io.IOException: java: not found
        at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
        at java.lang.ProcessImpl.start(ProcessImpl.java:65)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
        at java.lang.Runtime.exec(Runtime.java:591)
        at java.lang.Runtime.exec(Runtime.java:507)
        at 
org.codehaus.plexus.util.cli.Commandline.execute(Commandline.java:679)
        ... 27 more


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to