Broken Maven after switching to JDK 17

Bitrise Build Issue Report template

Description of the issue

After switching to JDK 17 using set-java-version@1 I can’t install dependencies with Maven.

+ mvn dependency:resolve
[ERROR] Error executing Maven.
[ERROR] java.lang.IllegalStateException: Unable to load cache item
[ERROR] Caused by: Unable to load cache item
[ERROR] Caused by: Could not initialize class$MethodWrapper
[ERROR] Caused by: Exception$CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int, throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @69a10787 [in thread "main"]

I tried sdk install maven 3.6.3 that was suggested on Stackoverflow to solve this issue in Ubuntu, but got sdk: command not found


Where did the issue happen?

Android & Docker, on Ubuntu 20.04 Standard

Which build Step causes the issue and which version of the step?

script step when trying to run e2e test


  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : NO
  • Does the issue happen sporadically, or every time? : Every time
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? : Yesterday, but haven’t tried this earlier

Local reproduction

Can it be reproduced on your own Mac/PC by following our local debug guide? Please follow at least the first section (“Testing with a full clean git clone”) to make sure to test the state of the code what will get when it does a git clone in the clean environment! If possible please note which sections you tried.

It works locally in Mac OS

Local reproduction: Linux / Android (docker based) stack builds

Can it be reproduced by running the build locally, after doing a new git clone of the repository into the /tmp directory and running the build from there with the Bitrise CLI ( )? If no, can it be reproduced with Docker (using the same docker images / environment we use on Related guide: Running your build locally in Docker - Bitrise Docs .

Can’t run Android emulator in Docker on M1

Build log


Got a reply on my support ticket so sharing here:

Please try installing the requested Maven version via this script:

curl -O
tar -xf apache-maven-3.9.4-bin.tar.gz
export PATH=$(pwd)/apache-maven-3.9.4/bin:$PATH
envman add --key "PATH" --value "$HOME/.maven/bin:$PATH"

You can then confirm this in another Script step via this command:

mvn --version

You can switch the above specified version with a different available one, of course.

Would of course be better if the pre-installed version worked with all JDK versions or the set-java-version step took care of this, but it unblocked me anyway.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.