Build failed when deploying to Talend Cloud on Java 17 - Workaround - Cloud - 8.0

Talend Software Development Life Cycle Best Practices Guide

Version
Cloud
8.0
Language
English
Product
Talend Big Data
Talend Big Data Platform
Talend Cloud
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Administration Center
Talend Artifact Repository
Talend CommandLine
Talend JobServer
Talend Management Console
Talend Remote Engine
Talend Studio
Content
Administration and Monitoring
Deployment
Design and Development
Last publication date
2024-02-16

When running CI Maven commands for publishing artifacts to Talend Cloud after moving to Java 17, you can get this type of build error:

Unable to make field private static volatile java.net.Authenticator 
java.net.Authenticator.theAuthenticator accessible: module java.base 
does not "opens java.net" to unnamed module XX

To fix this, you need to add some changes to the Maven startup configuration file.

Workaround for Windows users

Add this line to the file <Maven_home>/bin/mvn.cmd:
set "MAVEN_OPTS=%MAVEN_OPTS% --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/sun.security.x509=ALL-UNNAMED --add-opens=java.base/sun.security.pkcs=ALL-UNNAMED"

Save your changes and restart the build.

Workaround for Linux users

Add this line to the file <Maven_home>\bin\mvn:
export MAVEN_OPTS="$MAVEN_OPTS \
--add-opens=java.base/java.net=ALL-UNNAMED \
--add-opens=java.base/sun.security.x509=ALL-UNNAMED \
--add-opens=java.base/sun.security.pkcs=ALL-UNNAMED"

Save your changes and restart the build.

Workaround for Jenkins

If you are using Java 17 with a Jenkins server, edit the TALEND_CI_RUN_CONFIG part of the XML file in jenkins_pipeline_simple.zip to add these parameters.

Save your changes and restart the build.