Quentin Lerebours
Quentin Lerebours

Reputation: 766

Maven multi module does not resolve locally build modules

I have a multi module project with maven / quarkus / kotlin. Maven version: 3.9.5

The problem:

When running tests, an integration test (located in the "application" module) fails with "NoSuchMethod" but the method exists (in the "surcharge" module) and the tests works depending on how it's run.

What I noticed

When running mvn clean install -PmyProfile it seems to download modules on the remote repository:

Downloading from <repository>: <urlDuRepositoryNexus>/repository/<repository>/fr/my/project/surcharge/1.18.0-my-profile-SNAPSHOT/maven-metadata.xml
Downloaded from <repository>: <urlDuRepositoryNexus>/repository/<repository>/fr/my/project/surcharge/1.18.0-my-profile-SNAPSHOT/maven-metadata.xml

It does that for each submodule. When running with mvn clean install only, it doesn't download it from the remote repository (I don't have these logs).

It's what makes me think that maven prioritize getting distant dependencies to the one just build by the mvn clean install.

My configuration

/pom.xml

    <groupId>fr.my.project</groupId>
    <artifactId>project</artifactId>
    <version>${revision}${changelist}</version>
    <name>project</name>
    <packaging>pom</packaging>

    <modules>
        ... modules
        <module>surcharge</module>
    </modules>

    ...

    <profiles>
        <profile>
            <id>my-profile</id>
            <properties>
                <changelist>-my-profile-SNAPSHOT</changelist>
            </properties>
        </profile>
    </profiles>

/surchage/pom.xml

    <parent>
        <groupId>fr.my.project</groupId>
        <artifactId>project</artifactId>
        <version>${revision}${changelist}</version>
    </parent>

    <artifactId>surcharge</artifactId>
    <name>surcharge</name>

I don't really know what's bad in this configuration, but I know that sometimes I also have to clean install before running the project (the application module) because the new changes in the modules are not detected.

Upvotes: 0

Views: 19

Answers (0)

Related Questions