TeamCity Agent, offering multiple JDKs from different vendors with the same Major version
Hello
we plan to move a lot of our java builds to use openjdk. But some builds still require the oracle jdk.
We have read how to define multiple JDKs on an agent: https://confluence.jetbrains.com/display/TCD18/Predefined+Build+Parameters#PredefinedBuildParameters-DefiningJava-relatedEnvironmentVariables
but it seems TeamCity is a bit too smart. It only selects the latest version of a JDK if multiple with the same major version are found. Since we have 1.8 of oracle jdk and openjdk along with 11 of oracle jdk and openjdk we only see one of each major version to be selected in the build steps. But we would like to have them both available.
Is there a way to configure two different JDKs on an agent with the same major version but from different vendors?
Please sign in to leave a comment.
Hi Werner,
We provide a number of autodetected versions, but the detection has its limitations, as you have experienced. In this case, it would make sense for you to create your own set of parameter (probably environment variables, although you can use any kind you want) and then use those when you need to reference them.
Would that work for you?
Hello
Thanks for the reply!
Well the autodetect seems a bit unnessary (at least in our case). Since we just wanted to configure JDKs and its Names in the UI - maybe different distributions from the same version (Azul OpenJDK, Adopt Open JDK, Oracle JDK).
We noted the JDKs can be set to custom in the build steps and then we can set any environment variable available on the agent. So we will go that path. That will work for us.
Thanks!
To expand on this, is it also possible to define environment variables for multiple versions of openjdk?
For example, we have some projects which are stuck on old versions of OpenJDK 1.8_25, but I would also like to have the latest OpenJDK 1.8 installed too. Can I define JDK_18 and JDK_18_25 and have then show up in the available list?
Hi Dan,
agents pick up their environment variables upon startup, so any variable that you set should be picked up automatically. You can also set them explicitly on the build agent startup properties. You would need to restart the build agent afterwards to make sure they are picked up.