Skip to content

API incompatibility when using Maven 4.0.0-RC3 #326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
PinkMoustacheMan opened this issue Apr 14, 2025 · 2 comments
Open

API incompatibility when using Maven 4.0.0-RC3 #326

PinkMoustacheMan opened this issue Apr 14, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@PinkMoustacheMan
Copy link

Affected version

4.0.0-beta-2

Bug description

When trying to compile Java code using Maven 4.0.0-RC3 a NoSuchMethodError is thrown. This does not happen when using Maven 4.0.0-RC2.

The command I execute is

<path-to-my-maven-4-installation>/bin/mvn verify

Here is the full error message

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:4.0.0-beta-2:compile (default-compile) on project untitled: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:4.0.0-beta-2:compile failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-compiler-plugin:4.0.0-beta-2:compile: java.lang.NoSuchMethodError: 'java.util.List org.apache.maven.api.services.ProjectManager.getCompileSourceRoots(org.apache.maven.api.Project, org.apache.maven.api.ProjectScope)'
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-compiler-plugin:4.0.0-beta-2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/philip/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/4.0.0-beta-2/maven-compiler-plugin-4.0.0-beta-2.jar
[ERROR] urls[1] = file:/home/philip/.m2/repository/org/ow2/asm/asm/9.7.1/asm-9.7.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api.v4, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------

This is the entirety of my pom

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 http://maven.apache.org/xsd/maven-4.1.0.xsd">
    <modelVersion>4.1.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>untitled</artifactId>
    <version>1.0-SNAPSHOT</version>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>4.0.0-beta-2</version>
                <configuration>
                    <release>23</release>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
@PinkMoustacheMan PinkMoustacheMan added the bug Something isn't working label Apr 14, 2025
@desruisseaux
Copy link
Contributor

Yes, this is a known issue already fixed in this commit. That commit was done as part of #320, which is waiting for review in order to be merged.

@PinkMoustacheMan
Copy link
Author

Good to know, thanks for the quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants