Hi again,

I patched out jenkins using the following code snippet
in AbstractMavenProcessFactory#buildMavenAgentCmdLine(...)

JDK jdk = getJava(listener);
        if(jdk==null) {
            // ffromm, 2013-02-17: get JAVA_HOME from envVars
            if(envVars.containsKey("JAVA_HOME")) {
                args.add(envVars.get("JAVA_HOME") + "/bin/java");
            } else {
                args.add("java");
            }
        } else {
            args.add(jdk.getHome()+"/bin/java"); // use JDK.getExecutable()
here ?
        }

If no JDK is selected in the job's config, the environment variable
"JAVA_HOME" is used, if set. For most of our projects this works fine. But
when a sub compile task is needed, as it is used in jasper reports plugin,
the javac is not found and the build fails. Now we use different jobs for
each jdk.

Regards,

Frederik


2013/1/17 ffromm <[email protected]>

> Hi,
>
> we have a generic maven project/job to build release candidates of our
> java components. All of them used jdk 1.6. But now, the first component
> wants to use jdk 1.7. As I want to avoid job duplication only for the use
> of different jdks, I want to choose the jdk on build start by an upstream
> build.
>
> Now I have the problem that it seems not possible to define the jdk to use
> on start of a build tiggered by another build. I tried to pass JAVA_HOME as
> environment parameter but it is not used.
>
> We use jenkins 1.466-2 and I found the responsible code in [1] line 221.
> There is no code to take the JAVA_HOME from envVars.
>
> Is there any reason why this is not yet implemented? Otherwise I think I
> could do this.
>
> Thanks and regards,
>
> Frederik
> [1]
> https://github.com/jenkinsci/jenkins/blob/master/maven-plugin/src/main/java/hudson/maven/AbstractMavenProcessFactory.java
>

Reply via email to