Skip to content

Maven build succeeds locally but fails in Jenkins ("NoSuchMethodError" in Spring Cloud Contract plugin) #2430

@Awakuruf

Description

@Awakuruf

Summary

I'm seeing a build inconsistency between my local environment and our Jenkins pipeline.
Locally, mvn clean install completes successfully with no errors.
However, on Jenkins the build fails during the Spring Cloud Contract test generation phase with a NoSuchMethodError related to org.eclipse.aether.SessionData.

This is the error from Jenkins:

[INFO] --- spring-cloud-contract-maven-plugin:4.3.0:generateTests (default-generateTests) @ test-provider-service ---
--
  |   |   | [INFO] Generating server tests source code for Spring Cloud Contract Verifier contract verification
  |   |   | [INFO] Download dependency is provided - will retrieve contracts from a remote location
  |   |   | [INFO] Will download stubs and contracts via Aether
  |   |   | [INFO] Resolved version is [0.0.1-contract-test-SNAPSHOT]
  |   |   | [INFO] ------------------------------------------------------------------------
  |   |   | [INFO] BUILD FAILURE
  |   |   | [INFO] ------------------------------------------------------------------------
  |   |   | [INFO] Total time:  18.524 s
  |   |   | [INFO] Finished at: 2026-02-27T20:38:43Z
  |   |   | [INFO] ------------------------------------------------------------------------
  |   |   | [ERROR] Failed to execute goal org.springframework.cloud:spring-cloud-contract-maven-plugin:4.3.0:generateTests (default-generateTests) on project test-provider-service: Execution default-generateTests of goal org.springframework.cloud:spring-cloud-contract-maven-plugin:4.3.0:generateTests failed: An API incompatibility was encountered while executing org.springframework.cloud:spring-cloud-contract-maven-plugin:4.3.0:generateTests: java.lang.NoSuchMethodError: 'java.lang.Object org.eclipse.aether.SessionData.computeIfAbsent(java.lang.Object, java.util.function.Supplier)'

Environment Details

Local

  • Build: Successful
  • Java version: openjdk version "17.0.4.1" 2022-08-12 LTS
    *. OpenJDK Runtime Environment Zulu17.36+17-CA (build 17.0.4.1+1-LTS)
  • Maven version: Apache Maven 3.6.3
  • OS: macOS

Jenkins

  • Build: Fails during spring-cloud-contract-maven-plugin:generateTests
  • Maven version: Apache Maven 3.6.3
  • Jenkins agent OS: Linux

Questions

  1. Does the Spring Cloud Contract plugin require a minimum Maven version?
    If so, what is the minimum supported version?

  2. Is this a known compatibility issue with Maven 3.6.x or older?

  3. Should Jenkins be upgraded to a newer Maven or JDK version to support this plugin?


Additional Logs / Config

If helpful, I can provide:

  • Full Jenkins console output
  • pom.xml
  • Jenkins pipeline configuration

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions