Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support Java 17 runtime #482

Closed
kwonglau opened this issue Sep 16, 2021 · 20 comments
Closed

support Java 17 runtime #482

kwonglau opened this issue Sep 16, 2021 · 20 comments

Comments

@kwonglau
Copy link

could we add support for Java 17 runtime

@DaanVleugels
Copy link

Is there some way to use corretto 17 while waiting for this version to be supported?

@joschi
Copy link

joschi commented Sep 30, 2021

@DaanVleugels You could install Corretto 17 and activate it in your buildspec.yml similar to how it's done for Corretto 8 and 11.

Example:

RUN set -ex \
# Install Corretto 11
# Note: We will use update-alternatives to make sure JDK11 has higher priority for all the tools
&& apt-get install -y java-11-amazon-corretto-jdk \
&& for tool_path in $JAVA_HOME/bin/*; do \
tool=`basename $tool_path`; \
update-alternatives --install /usr/bin/$tool $tool $tool_path 10000; \
update-alternatives --set $tool $tool_path; \
done \
&& rm $JAVA_HOME/lib/security/cacerts && ln -s /etc/ssl/certs/java/cacerts $JAVA_HOME/lib/security/cacerts \

corretto11:
commands:
- echo "Installing Java version 11 ..."
- export JAVA_HOME="$JAVA_11_HOME"
- export JRE_HOME="$JRE_11_HOME"
- export JDK_HOME="$JDK_11_HOME"
- |-
for tool_path in "$JAVA_HOME"/bin/*;
do tool=`basename "$tool_path"`;
if [ $tool != 'java-rmi.cgi' ];
then
update-alternatives --list "$tool" | grep -q "$tool_path" \
&& update-alternatives --set "$tool" "$tool_path";
fi;
done

@MattFellows
Copy link

Just FYI - because I followed this advice - doing so seems to break docker in docker capability, or, more specifically, using any non-managed image seems to prevent using docker in docker currently...

@joschi
Copy link

joschi commented Nov 1, 2021

@MattFellows How exactly did you build your custom image? I built one based on ubuntu/standard:5.0 some time ago and I don't remember it breaking DinD.

@DaanVleugels
Copy link

@joschi, do you still have your version? I have been trying a little, but bumped against upgrading the Gradle version without breaking the old versions’ builds.

@kevintweber
Copy link

There is a PR for this request: #495

@rnferreira
Copy link

Any update about this?

@rasensio
Copy link

Looks like is stuck. So, for now, installing manually

@joschi
Copy link

joschi commented Jan 29, 2022

@rasensio Depending on your build process, looking into Maven Toolchains (see also Introduction to Maven Toolchains) or Gradle Toolchains might be preferable since they also work on local developer machines and that way you don't need to manage JDKs on AWS CodeBuild differently.

@rasensio
Copy link

rasensio commented Jan 31, 2022

Thanks @joschi . I fixed it just with this in the buildspec.yml

pre_build:
commands:
- echo Nothing to do in the pre_build phase...
- yum install java-17-amazon-corretto-devel -y
- alternatives --set java /usr/lib/jvm/java-17-amazon-corretto.aarch64/bin/java

@braek
Copy link

braek commented Feb 21, 2022

@rasensio Which environment are you using in AWS to make this work?

@rasensio
Copy link

@rasensio Which environment are you using in AWS to make this work?

latest amazon linux

@braek
Copy link

braek commented Feb 21, 2022

@rasensio Which environment are you using in AWS to make this work?

latest amazon linux

Thanks for the tip! Managed to get my pipeline completely running now for a project using Java 17.

I still hope Amazon will add a managed image for Java 17 in the near future though.

@AdamBien
Copy link

Corretto 17 on AWS CodeBuild and maven are working, but have to be setup manually: https://adambien.blog/roller/abien/entry/installing_java_17_amazon_corretto

However: Corretto 17 installation slows down the build pipeline and is a waste of resources.

Please support Corretto 17 in e.g. aws/codebuild/standard:6.0 to avoid the "Undifferentiated Heavy Lifting" :-)

@gyokutoku
Copy link

Here is buildspec I used for "aws/codebuild/amazonlinux2-x86_64-standard:3.0" and maven build( requires JDK environment, not JRE). Thanks @AdamBien

env:
variables:
JAVA_HOME: "/usr/lib/jvm/java-17-amazon-corretto.x86_64/"
install:
commands:
- java -version
- yum -y install java-17-amazon-corretto
- update-alternatives --auto javac
- update-alternatives --auto java
- java -version

Of course you can determine the exact path by the checking the result of ls -l /usr/lib/jvm/

@stnor
Copy link

stnor commented Apr 7, 2022

JDK17 has been out 6 months now. Are there any plans to roll 6.0 with coretto-17 please? I'd like a timeline and would rather not roll my own image.

@subinataws
Copy link
Contributor

Addressed in https://github.com/aws/aws-codebuild-docker-images/releases/tag/22.06.30

@fliedonion
Copy link

Why was this issue closed ?
How about ARM ?

@MuhammadBilalYar01
Copy link

Seems like still this is an issue

@RafaJMoraes
Copy link

Obrigado@joschi. Eu consertei apenas com isso no buildspec.yml

pre_build: commands: - echo Nothing to do in the pre_build phase... - yum install java-17-amazon-corretto-devel -y - alternatives --set java /usr/lib/jvm/java-17-amazon-corretto.aarch64/bin/java

E como fica o phases?
phases:
install:
runtime-versions:
java: corretto??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests