# Guava multi-module build container # Builds Guava from source using Maven with a Java 25 toolchain FROM maven:3.9.14-sapmachine-25 # Build in /workspace/guava WORKDIR /workspace/guava # Copy the entire repository into the image COPY . . # First pass: install all modules (skipping tests to speed up) RUN mvn -B -ntp -Dtoolchain.skip install -U -DskipTests=true # Second pass: verify the build (also skips tests) # This covers the Android flavor and other modules as configured by the root pom.xml RUN mvn -B -ntp -P!standard-with-extra-repos -Dtoolchain.skip verify -U -DskipTests=true # The image now contains built artifacts under the repository's target/ directories. # A simple shell is provided as the default command for convenience. CMD ["bash"]
# Ignore common VCS and IDE directories .git/ .gitignore .gitmodules .svn/ .idea/ .project .classpath .settings/ target/ out/ build/ *.log *.tmp *.bak # Node and Python caches (if present) node_modules/ pip-cache/ __pycache__/ # OS files .DS_Store Thumbs.db # Maven local repository (downloaded jars are cached in /root/.m2 by Maven) .m2/
Failing step/command - [4/5] RUN mvn -B -ntp -Dtoolchain.skip install -U -DskipTests=true - Exit code: 1 - Exact error messages - [ERROR] No toolchain found for type jdk - [ERROR] Cannot find matching toolchain definitions for the following toolchain types: - [ERROR] jdk [ version='25' ] - [ERROR] Please make sure you define the required toolchains in your ~/.m2/toolchains.xml file. - [ERROR] -> [Help 1] - [ERROR] Failed to execute goal org.apache.maven.plugins:maven-toolchains-plugin:3.2.0:toolchain (default) on project guava: Cannot find matching toolchain definitions for the following toolchain types: - [ERROR] jdk [ version='25' ] - [ERROR] Please make sure you define the required toolchains in your ~/.m2/toolchains.xml file. - Final failure note - Dockerfile:13 - ERROR: failed to build: failed to solve: process "/bin/sh -c mvn -B -ntp -Dtoolchain.skip install -U -DskipTests=true" did not complete successfully: exit code: 1 Missing packages/files mentioned - ~/.m2/toolchains.xml (toolchains definitions file) Version mismatch / configuration details - Toolchain issue: No toolchain found for type jdk, required toolchain: jdk [ version='25' ] - Maven Toolchains plugin cannot find matching toolchain definitions for jdk version 25 - Suggests defining the required toolchains in ~/.m2/toolchains.xml - Context: base image uses maven:3.9.14-sapmachine-25, but toolchains.xml definitions are missing or do not include JDK 25.
# Guava multi-module build container
# Builds Guava from source using Maven with a Java 25 toolchain
FROM maven:3.9.14-sapmachine-25
# Build in /workspace/guava
WORKDIR /workspace/guava
# Copy the entire repository into the image
COPY . .
# Provide a toolchains.xml so Maven toolchains plugin can find a JDK 25 toolchain
# This helps when the base image provides SAPMachine 25 but tooling needs explicit config.
RUN mkdir -p /root/.m2 && cat > /root/.m2/toolchains.xml << 'XML'
<?xml version="1.0" encoding="UTF-8"?>
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>25</version>
<vendor>SAP</vendor>
</provides>
<configuration>
<jdkHome>/usr/lib/jvm/sapmachine-25</jdkHome>
</configuration>
</toolchain>
</toolchains>
XML
# First pass: install all modules (skipping tests to speed up)
RUN mvn -B -ntp -Dtoolchain.skip install -U -DskipTests=true
# Second pass: verify the build (also skips tests)
# This covers the Android flavor and other modules as configured by the root pom.xml
RUN mvn -B -ntp -P!standard-with-extra-repos -Dtoolchain.skip verify -U -DskipTests=true
# The image now contains built artifacts under the repository's target/ directories.
# A simple shell is provided as the default command for convenience.
CMD ["bash"]
Concerns: Potential typo in the Maven flag -Dtoolchain.skip which may not skip the toolchains plugin (-Dtoolchains.skip is typical). Smoke [PASS]: find /workspace/guava -name "*.jar" -print -quit Smoke [PASS]: java -version 2>&1 | head -n 1