Skip to content

Multi-module liberty dev mode fails when there exists a test-jar dependency #1561

@lmsurpre

Description

@lmsurpre

I have an existing multi-module web application and I want to use liberty dev mode with it.

One of the modules has some test utilities which are used in the tests of the other modules.
Maven supports that through the use of a build plugin configuration like this:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Then, in the modules that depend on it, we declare the dependency with a type of test-jar (or, equivalently, with a classifier of tests)

This builds fine with a command like mvn clean install -f parent. However, if one of those modules has our liberty config and we try using mvn liberty:dev -f parent then we end up with an error like the following:

Could not resolve dependencies for project io.openliberty.guides:module2:war:1.0-SNAPSHOT: Could not find artifact io.openliberty.guides:module1:jar:tests:1.0-SNAPSHOT

Attached is a minimal reproducer that adapts the OpenLiberty getting started example to demonstrate the issue.
multimodule-testjar-reproducer.zip
After unzipping, run the following to see the error:

mvn liberty:dev -f parent

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions