0

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.

  • Running with mvn clean install works
  • Running with mvn clean install -PmyProfile doesn't work

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.

2
  • It probably depends on how the version is computed, since you have some properties there. You might want to try to see the effective POM (via CLI or via IDE). If your build requires X.Y.Z-SNAPSHOT but your child module has version X.Y.W-SNAPSHOT, Maven might try to download it, instead of building it. What other modules do you have in the parent, especially other modules that depend on surcharge? Commented Dec 20, 2024 at 7:19
  • Sounds like a dependency issue in the module which uses it... Having defined a dependency to that required module? Commented Dec 20, 2024 at 8:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.