Skip to content

Maven builds failing since October 4, 2024

0

We have a Maven build set up under CodeBuild. Since Friday, October 4, 2024 the build has started to fail without any change to the build configuration. CodeBuild details are given below:

  • Image: aws/codebuild/amazonlinux2-x86_64-standard:4.0
  • Image version: latest
  • Build type: Java 17 + Maven

The error we see in the build logs is:

[Container] 2024/10/07 04:02:34.981207 Running command aws --version
aws-cli/1.34.28 Python/3.9.17 Linux/4.14.291-218.527.amzn2.x86_64 exec-env/AWS_ECS_EC2 botocore/1.35.28

[Container] 2024/10/07 04:02:48.553833 Running command docker --version
Docker version 20.10.24, build 297e128

[Container] 2024/10/07 04:02:48.577363 Running command java -version
openjdk version "17.0.12" 2024-07-16 LTS
OpenJDK Runtime Environment Corretto-17.0.12.7.1 (build 17.0.12+7-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.12.7.1 (build 17.0.12+7-LTS, mixed mode, sharing)

[Container] 2024/10/07 04:02:50.780421 Running command mvn -v
Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546)
Maven home: /opt/maven
Java version: 17.0.12, vendor: Amazon.com Inc., runtime: /usr/lib/jvm/java-17-amazon-corretto.x86_64
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.14.291-218.527.amzn2.x86_64", arch: "amd64", family: "unix"

[Container] 2024/10/07 04:02:53.359049 Running command mvn clean package spring-boot:repackage -DskipTests
[INFO] Scanning for projects...

...

Downloaded from central: https://repo.maven.apache.org/maven2/org/springframework/session/spring-session-bom/2021.2.3/spring-session-bom-2021.2.3.pom (3.1 kB at 441 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/cloud/spring-cloud-contract-parent/3.1.4/spring-cloud-contract-parent-3.1.4.pom
                   
Downloaded from central: https://repo.maven.apache.org/maven2/org/springframework/cloud/spring-cloud-contract-parent/3.1.4/spring-cloud-contract-parent-3.1.4.pom (23 kB at 3.3 MB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/cloud/spring-cloud-build/3.1.4/spring-cloud-build-3.1.4.pom
                   
Downloaded from central: https://repo.maven.apache.org/maven2/org/springframework/cloud/spring-cloud-build/3.1.4/spring-cloud-build-3.1.4.pom (59 kB at 2.1 MB/s)
Downloading from maven-restlet: https://maven.restlet.org/org/springframework/cloud/spring-cloud-commons-dependencies/3.1.4/spring-cloud-commons-dependencies-3.1.4.pom
                   
[WARNING] Checksum validation failed, expected '<!doctype' (REMOTE_EXTERNAL) but is actually 'dffa46b79ae9c63188a412549c67b515d4adb65a' from maven-restlet for https://maven.restlet.org/org/springframework/cloud/spring-cloud-commons-dependencies/3.1.4/spring-cloud-commons-dependencies-3.1.4.pom
[WARNING] Could not validate integrity of download from https://maven.restlet.org/org/springframework/cloud/spring-cloud-commons-dependencies/3.1.4/spring-cloud-commons-dependencies-3.1.4.pom
org.eclipse.aether.transfer.ChecksumFailureException: Checksum validation failed, expected '<!doctype' (REMOTE_EXTERNAL) but is actually 'dffa46b79ae9c63188a412549c67b515d4adb65a'

The relevant portions of the Maven pom.xml file are shown below.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>sample</artifactId>
    <version>124</version>
    <properties>
        <java.version>17</java.version>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.7.18</version>
            </plugin>
        </plugins>
    </build>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>2.7.18</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>2021.0.9</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>
asked a year ago870 views
2 Answers
0
Accepted Answer

The Maven build failure you're experiencing since October 4, 2024, appears to be related to a repository issue, specifically with the maven-restlet repository. The error message indicates a checksum validation failure when trying to download a dependency from https://maven.restlet.org.

To resolve this issue, you can try the following steps:

  1. Remove the maven-restlet repository from your Maven settings if it's explicitly defined. This repository seems to be causing issues and may not be necessary for your build.

  2. Ensure that your project is using the secure central Maven repository (https://repo1.maven.org/maven2) as its primary source for dependencies. CodeBuild-provided Java build environments typically include a settings.xml file that directs Maven to use this repository.

  3. If you need to override the default Maven settings in CodeBuild, you can add a custom settings.xml file to your source code and instruct CodeBuild to use it. Here's how you can do this:

a. Create a settings.xml file in your project with the repositories you want to use. b. In your buildspec.yml file, add a command in the install phase to copy this file to the correct location:

version: 0.2

phases:
install:
commands:
- cp ./settings.xml /root/.m2/settings.xml
  1. If the issue persists, you may need to update your project's dependencies, particularly the Spring Cloud dependencies, to ensure you're using versions that are compatible with your Spring Boot version and available in the central Maven repository.

  2. As a temporary workaround, you could try disabling checksum validation in your Maven settings, but this is not recommended for security reasons and should only be used as a last resort for debugging.

By implementing these changes, you should be able to resolve the Maven build failure in your CodeBuild project.
Sources
Troubleshooting AWS CodeBuild - AWS CodeBuild

answered a year ago
EXPERT
reviewed a year ago
0

Hi, You have this problem because the mentioned dependency https://maven.restlet.org/org/springframework/cloud/spring-cloud-commons-dependencies/3.1.4/spring-cloud-commons-dependencies-3.1.4.pom doesn't seem to publish (anymore ?) its checksum for content validation / authentication.

You can work around this by adding the option -DcreateChecksum=fals until the problem on gets fixed on spring-cloud-commons-dependencies-3.1.4.pom

Best,

Didier

EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.