Managing multiple JDKs, Maven enforcer and JAVA_HOME

We've successfully installed multiple JDKs on the build agent and can select JDK in the Maven build step -- great.

Unfortunately the Maven enforcer plugin fails for our builds, because it seems to use JAVA_HOME to determine the java version, not the actual JVM it's running under.

We can manually set env.JAVA_HOME to resolve this issue, but it seems to me that Teamcity could/should do this automatically based on the selected JDK for the build, if the environment property is not set explicitly anywhere. We don't set it in our buildAgent.properties.

Anyway, we have a workaround for now, I just wondered if there was a better way or of this is a known issue.

Please sign in to leave a comment.