maven and jdk8 on Alpine Linux image
Matthew Martinez
This is my first time working with an Alpine linux image. Its part of a Jenkins build pipeline.
When I try to compile my maven build (which requires Java 1.8) ... it gives an error suggested there is no compiler installed.
However, I confirmed its installed ... multiple ways;
Echo the JAVA_HOME variable which returns
/usr/lib/jvm/java-1.8-openjdkTested to confirm the compiler is there; by running "${JAVA_HOME}/javac -version" ... which returns;
/usr/lib/jvm/java-1.8-openjdk/bin/javac -version
javac 1.8.0_222- However, maven still points to the JRE ...
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T07:58:13Z)
Maven home: /usr/share/java/maven-3
Java version: 1.8.0_222, vendor: IcedTea
Java home: /usr/lib/jvm/java-1.8-openjdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.19.84-coreos", arch: "amd64", family: "unix"I tried manually installed the JDK ... but doesn't seem to help;
apk update apk add openjdk8 apk add mavenAny suggestions? I need Java 8 to compile this app ... and currently every attempt to do a "mvn clean install" results in a failure, as below;
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 1 Answer
Tried many different ideas and then eventually thought about setting the path to the compiler and amazingly, now it works!
export PATH=${PATH}:${JAVA_HOME}/bin mvn clean install