Skip to content
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

4.0.0-beta-1 fails in multi module projects #104

Closed
froque opened this issue Feb 17, 2025 · 6 comments · Fixed by apache/maven#2124
Closed

4.0.0-beta-1 fails in multi module projects #104

froque opened this issue Feb 17, 2025 · 6 comments · Fixed by apache/maven#2124
Labels
bug Something isn't working

Comments

@froque
Copy link

froque commented Feb 17, 2025

Affected version

4.0.0-beta-1

Bug description

pom.xml

<?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>org.example</groupId>
    <artifactId>maven-clean-4-demo</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <modules>
        <module>module1</module>
        <module>module2</module>
    </modules>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

</project>

module1/pom.xml

<?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>
    <parent>
        <groupId>org.example</groupId>
        <artifactId>maven-clean-4-demo</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <artifactId>module1</artifactId>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

</project>

module2/pom.xml

<?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>
    <parent>
        <groupId>org.example</groupId>
        <artifactId>maven-clean-4-demo</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <artifactId>module2</artifactId>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.example</groupId>
            <artifactId>module1</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

</project>
❯ /opt/maven/apache-maven-4.0.0-rc-2/bin/mvn -q org.apache.maven.plugins:maven-clean-plugin:3.4.0:clean
❯ /opt/maven/apache-maven-4.0.0-rc-2/bin/mvn -q org.apache.maven.plugins:maven-clean-plugin:4.0.0-beta-1:clean  
[ERROR] Failed to execute goal on project module2: Could not resolve dependencies for project org.example:module2:jar:1.0-SNAPSHOT
[ERROR] dependency: org.example:module1:jar:1.0-SNAPSHOT (compile)
[ERROR] : The following artifacts could not be resolved: org.example:module1:jar:1.0-SNAPSHOT (absent)
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the '-e' switch
[ERROR] Re-run Maven using the '-X' switch to enable verbose output
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn [args] -r
@froque froque added the bug Something isn't working label Feb 17, 2025
@slawekjaranowski
Copy link
Member

I confirm ....

What I see in logs:

for 3.4.0

[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): []

and for

[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): [runtime]

I also put plugin version in project pluginManagement, tested with phase clean

@gnodet @cstamas can you look?

@slawekjaranowski
Copy link
Member

Test in #105

@gnodet
Copy link
Contributor

gnodet commented Feb 24, 2025

The problem is the maven-plugin-plugin which generates a mojo descriptor with no dependencyResolution, but the mojo descriptor uses a default value of runtime.
See https://the-asf.slack.com/archives/C7Q9JB404/p1739812351694469

@slawekjaranowski
Copy link
Member

apache/maven#1559

@slawekjaranowski
Copy link
Member

@gnodet
Copy link
Contributor

gnodet commented Feb 25, 2025

It should be fixed by apache/maven#2124

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

Successfully merging a pull request may close this issue.

3 participants