Expand my Community achievements bar.

SOLVED

Error: Failed to execute goal org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain (default) on project

Avatar

Level 1

I created a image with jdk1.8-maven3.9.6 as my application needs jdk1.8

FROM amazoncorretto:8-al2023-jdk

 

ARG MAVEN_VERSION=3.9.6

ARG USER_HOME_DIR="/app"

ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"

ARG SHA=706f01b20dec0305a822ab614d51f32b07ee11d0218175e55450242e49d2156386483b506b3a4e8a03ac8611bae96395fd5eec15f50d3013d5deed6d1ee18224

ARG BASE_URL="https://downloads.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries"

 

#using dnf instead of apt-get

RUN dnf update -y \

  && dnf install -y --allowerasing \

      ca-certificates curl git gnupg dirmngr tar \

  && dnf clean all

RUN mkdir -p /usr/share/maven && mkdir -p /app

RUN set -eux; curl -fsSLO --compressed ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \

  && echo "${SHA} *apache-maven-${MAVEN_VERSION}-bin.tar.gz" | sha512sum -c - \

  && curl -fsSLO --compressed ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz.asc \

  && export GNUPGHOME="$(mktemp -d)"; \

  for key in \

  6A814B1F869C2BBEAB7CB7271A2A1C94BDE89688 \

  29BEA2A645F2D6CED7FB12E02B172E3E156466E8 \

  ; do \

  gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" ; \

  done; \

  gpg --batch --verify apache-maven-${MAVEN_VERSION}-bin.tar.gz.asc apache-maven-${MAVEN_VERSION}-bin.tar.gz

COPY settings.xml /app/.m2/settings.xml

ENV MAVEN_HOME /usr/share/maven

RUN mkdir -p ${MAVEN_HOME} ${MAVEN_HOME}/ref \

  && tar -xzf apache-maven-${MAVEN_VERSION}-bin.tar.gz -C ${MAVEN_HOME} --strip-components=1 \

  && ln -sf /usr/share/maven/bin/mvn /usr/bin/mvn

but when i use this in github actions for mvn test
It throws error:

Error: Failed to execute goal org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain (default) on project xtv-authn: Cannot find matching toolchain definitions for the following toolchain types:
1172Error: jdk [ version='1.8' ]

when i have the required jdk installed, why it is still asking for toolchains 
openjdk version "1.8.0_422"
OpenJDK Runtime Environment Corretto-8.422.05.1 (build 1.8.0_422-b05)
OpenJDK 64-Bit Server VM Corretto-8.422.05.1 (build 25.422-b05, mixed mode)
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: /usr/share/maven
Java version: 1.8.0_422, vendor: Amazon.com Inc., runtime: /usr/lib/jvm/java-1.8.0-amazon-corretto.x86_64/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-153-generic", arch: "amd64", family: "unix"



 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Awslogin3016He ,

Check toochain.xml file if it contains the jdk path or not.

 

Thanks

Himanshu Jain

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @Awslogin3016He ,

Check toochain.xml file if it contains the jdk path or not.

 

Thanks

Himanshu Jain

Avatar

Administrator

@Awslogin3016He Did you find the suggestion helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!



Kautuk Sahni