Unable to build with Bamboo Specs due to error "No compiler is provided in this environment"
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
問題
When Maven is pointing to a Java path that doesn't include compilers, Bamboo specs will not run and will produce an error as described below
20-Jul-2020 15:34:42 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project bamboo-specs-generator: Compilation failure
20-Jul-2020 15:34:42 [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
20-Jul-2020 15:34:42 [ERROR] -> [Help 1]
20-Jul-2020 15:34:42 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project bamboo-specs-generator: Compilation failure
20-Jul-2020 15:34:42 No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
診断
環境
Bamboo Server
- Maven
You can confirm what version/location of Java is being used by Maven as in the example below
mvn --version
Apache Maven 3.6.0
Maven home: /usr/share/maven
Java version: 1.8.0_221, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.15.0-72-generic", arch: "amd64", family: "unix"
原因
$JAVA_HOME is not pointing to a path with a JAVA compiler (JDK)
ソリューション
Make sure $JAVA_HOME variable is pointing to a Java JDK path.