Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-659

If only one JDK is configured in system, don't offer JDK config in projects

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None
    • Platform: All, OS: All

      It seems that Maven is started with the system's (or tomcat's) Java environment
      settings (path, classpath,...).
      As there are JDK-installations configured in Hudson I think it would be handy if
      you can select one of them to be used by Maven.

          [JENKINS-659] If only one JDK is configured in system, don't offer JDK config in projects

          Is this the native m2 support, or the free-style project with Maven as the main
          build action? What OS is this?

          In both cases, Hudson does use the JDK you configured for the project. It sets
          PATH to include $JAVA_HOME/bin, as well as JAVA_HOME. So I believe the maven
          launcher script is supposed to pick up the right java.

          Is your maven script modified?

          Kohsuke Kawaguchi added a comment - Is this the native m2 support, or the free-style project with Maven as the main build action? What OS is this? In both cases, Hudson does use the JDK you configured for the project. It sets PATH to include $JAVA_HOME/bin, as well as JAVA_HOME. So I believe the maven launcher script is supposed to pick up the right java. Is your maven script modified?

          d_lehmann added a comment -

          The project is native m2, on Linux (Debian Etch).

          Here is the output from those failed builds:

          started
          $ java -cp
          /opt/tomcat-webtest/webapps/hudson/WEB-INF/lib/maven-agent-1.116.jar:/opt/maven/current/core/boot/classworlds-1.1.jar
          hudson.maven.agent.Main /opt/maven/current
          /opt/tomcat-webtest/webapps/hudson/WEB-INF/lib/remoting-1.116.jar
          /opt/tomcat-webtest/webapps/hudson/WEB-INF/lib/maven-interceptor-1.116.jar
          FATAL: java.io.IOException: java: not found
          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 hudson.Launcher$LocalLauncher.launchChannel(Launcher.java:178)
          at hudson.maven.MavenBuild$RunnerImpl.newProcess(MavenBuild.java:296)
          at hudson.maven.ProcessCache.get(ProcessCache.java:166)
          at hudson.maven.MavenBuild$RunnerImpl.doRun(MavenBuild.java:265)
          at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:127)
          at hudson.model.Run.run(Run.java:562)
          at hudson.maven.MavenBuild.run(MavenBuild.java:128)
          at hudson.model.Executor.run(Executor.java:59)

          d_lehmann added a comment - The project is native m2, on Linux (Debian Etch). Here is the output from those failed builds: started $ java -cp /opt/tomcat-webtest/webapps/hudson/WEB-INF/lib/maven-agent-1.116.jar:/opt/maven/current/core/boot/classworlds-1.1.jar hudson.maven.agent.Main /opt/maven/current /opt/tomcat-webtest/webapps/hudson/WEB-INF/lib/remoting-1.116.jar /opt/tomcat-webtest/webapps/hudson/WEB-INF/lib/maven-interceptor-1.116.jar FATAL: java.io.IOException: java: not found 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 hudson.Launcher$LocalLauncher.launchChannel(Launcher.java:178) at hudson.maven.MavenBuild$RunnerImpl.newProcess(MavenBuild.java:296) at hudson.maven.ProcessCache.get(ProcessCache.java:166) at hudson.maven.MavenBuild$RunnerImpl.doRun(MavenBuild.java:265) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:127) at hudson.model.Run.run(Run.java:562) at hudson.maven.MavenBuild.run(MavenBuild.java:128) at hudson.model.Executor.run(Executor.java:59)

          Code at MavenBuild.java:330 launches java with the full JAVA_HOME prefix if you
          configured JDK with your Maven project, so it appears that your project is
          really not configured to use a particular JDK (and instead it must be left to
          use the "default" JDK.)

          Check your project configuration screen and set JDK.

          I improved error diagnosis code so that it will detect this situation and
          suggest this as the problem. This change will be in 1.125.

          Kohsuke Kawaguchi added a comment - Code at MavenBuild.java:330 launches java with the full JAVA_HOME prefix if you configured JDK with your Maven project, so it appears that your project is really not configured to use a particular JDK (and instead it must be left to use the "default" JDK.) Check your project configuration screen and set JDK. I improved error diagnosis code so that it will detect this situation and suggest this as the problem. This change will be in 1.125.

          d_lehmann added a comment -

          Ah, I understand now. Default JDK means the system's JDK.

          PEBCAK, sorry

          d_lehmann added a comment - Ah, I understand now. Default JDK means the system's JDK. PEBCAK, sorry

          I think the confusion is that if there's only one JDK configured in the system
          screen, the wording "(default JDK)" could mean that JDK.

          So I think the task here is to eliminate that configuration option altogether if
          there's only one JDK configured in the system.

          This change is in 1.149.

          Kohsuke Kawaguchi added a comment - I think the confusion is that if there's only one JDK configured in the system screen, the wording "(default JDK)" could mean that JDK. So I think the task here is to eliminate that configuration option altogether if there's only one JDK configured in the system. This change is in 1.149.

          akostadinov added a comment -

          can't you rename "default JDK" to "system default JDK"? It will be more
          meaningful and will not confuse users that expect the previous behavior on
          instances with one jdk configured?

          akostadinov added a comment - can't you rename "default JDK" to "system default JDK"? It will be more meaningful and will not confuse users that expect the previous behavior on instances with one jdk configured?

            Unassigned Unassigned
            d_lehmann d_lehmann
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: