Closed dwijnand closed 2 years ago
Here's the jabba oneliner:
jabba install "$(jabba ls-remote "adopt@~1.$TRAVIS_JDK.0-0" --latest minor)" && jabba use "$_" && java -Xmx32m -version
Testing:
08:16:34 $ for TRAVIS_JDK in 8 11; do jabba ls-remote "adopt@~1.$TRAVIS_JDK.0-0" --latest minor; done
adopt@1.8.212-04
adopt@1.11.28-0
However(!) there are some issues with AdoptOpenJDK 11 + 12 versions in jabba: https://github.com/shyiko/jabba/issues/481 🙁
Jabba should be returning "jdk-11.0.3+7" instead of "1.11.28-0".
Even better, you can just pass the ~
version to install
:
jabba install "adopt@~1.$TRAVIS_JDK.0-0"
However we can't use $_
any more, so it becomes:
jabba install "adopt@~1.$TRAVIS_JDK.0-0" && jabba use $(jabba ls "adopt@~1.$TRAVIS_JDK.0-0" --latest minor) && java -Xmx32m -version
Hehe, and you can keep using ~
for jabba use
too, so:
jabba install "adopt@~1.$TRAVIS_JDK.0-0" && jabba use "adopt@~1.$TRAVIS_JDK.0-0" && java -Xmx32m -version
... which is "$_"
, so we've gone full circle:
install: jabba install "adopt@~1.$TRAVIS_JDK.0-0" && jabba use "$_" && java -Xmx32m -version
But doesn't
install: jabba install "adopt@~1.$TRAVIS_JDK.0-0" && jabba use "$_" && java -Xmx32m -version
install 1.11.28-0
(instead of 1.11.0-4
, which is newer) for TRAVIS_JDK=11
?
(see https://github.com/lagom/lagom/pull/2199/files#diff-1d37e48f9ceff6d8030570cd36286a61L80)
That's right:
However(!) there are some issues with AdoptOpenJDK 11 + 12 versions in jabba: shyiko/jabba#481 🙁
Another option that we discussed is to use sdkman that can install the latest version without problems. @eed3si9n has a blog post about it:
Yeah, that's probably the better strategy.
Unfortunately, the sdkman isn't particularly designed to be scripted around, see https://github.com/scala/scala/pull/7931#discussion_r301434372 where I explored the possible ways to do it. I also reached out to the maintainers and they might have shipped better APIs by now.
But doesn't
install: jabba install "adopt@~1.$TRAVIS_JDK.0-0" && jabba use "$_" && java -Xmx32m -version
install
1.11.28-0
(instead of1.11.0-4
, which is newer) forTRAVIS_JDK=11
?(see https://github.com/lagom/lagom/pull/2199/files#diff-1d37e48f9ceff6d8030570cd36286a61L80)
This should be fixed now, see https://github.com/shyiko/jabba/issues/481#issuecomment-536038721
Mapping the state of our maintained projects:
Change of plan:
-install: jabba install "adopt@~1.$TRAVIS_JDK.0-0" && jabba use "$_" && java -Xmx32m -version
+install: jabba install $(jabba ls-remote "adopt@~1.$TRAVIS_JDK.0-0" --latest=patch) && jabba use "$_" && java -Xmx32m -version
This is to ensure that the latest version, for the current "major" Java version, is used. Previous if adopt@1.11.0-0 was already installed (via Travis CI's cache) even though adopt@1.11.0-5 is out, we'd not install it.
Applying in Omnidoc: https://github.com/playframework/omnidoc/pull/118.
We switched to The actions (even though some repos still missing) and we don't use Jabba anymore. We use coursier, which should always fetch the latest version of a jdk.
The Scala Team, in switching to AdoptOpenJDK in their CI, is finding a way to have CI always use the latest patched versions of AdoptOpenJDK 8 and 11 so they don't need to micro-manage nor be behind on patch versions:
There is no immediate rush to implement this and, particularly, we should wait for the implementation details to settle first. But eventually we should switch our CIs to use the same system.