Skip to content

Using maven.top-level-basedir property in quarkus-maven-plugin #22321

@ambition-consulting

Description

@ambition-consulting

Describe the bug

In 4d22dd3, Alexey Loubyansky has provided a mechanism to allow Quarkus's maven integration to deal with atypical maven structures.

Unfortunately, this integration currently only works for quarkus-maven-plugin by specifying it in the command line, e.g.

mvn quarkus:dev -Dmaven.top-level-basedir="/Users/johnDoo/myAwesomeRootProject"

Obviously whatever is true for test execution with surefire plugin, will also be true for quarkus:dev execution, so it would be great to add a maven-native way of adding it, e.g.

            <groupId>${quarkus.platform.group-id}</groupId>
            <artifactId>quarkus-maven-plugin</artifactId>
            <version>${quarkus.platform.version}</version>
            <extensions>true</extensions>
            <configuration>
                <systemPropertyVariables>
                    <maven.top-level-basedir>${maven.multiModuleProjectDirectory}</maven.top-level-basedir>

Expected behavior

I would expect the same fix, that works and gets loaded from maven for tests, to also work and get loaded from maven for dev. It works, but loading from maven does not yet.

Actual behavior

Values are ignored, except for command line provisioning:
mvn quarkus:dev -Dmaven.top-level-basedir="/Users/johnDoo/myAwesomeRootProject"

How to Reproduce?

Use quarkus maven plugin with:

<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.platform.version}</version>
<extensions>true</extensions>
<configuration>
    <argsString>-Dmaven.top-level-basedir=/Users/f6sb0mx/src/ecom/ecom-kernel</argsString>
    <jvmArgs>-Dmaven.top-level-basedir=/Users/f6sb0mx/src/ecom/ecom-kernel</jvmArgs>
    <debugPort>5006</debugPort>
    <properties>
        <maven.top-level-basedir>/Users/f6sb0mx/src/ecom/ecom-kernel</maven.top-level-basedir>
    </properties>
    <systemProperties>
        <property>
            <name>maven.top-level-basedir</name>
            <value>/Users/f6sb0mx/src/ecom/ecom-kernel</value>
        </property>
    </systemProperties>
</configuration>

use mvnDebug to breakpoint on io.quarkus.bootstrap.resolver.maven.BootstrapMavenContext#BootstrapMavenContext(io.quarkus.bootstrap.resolver.maven.BootstrapMavenContextConfig<?>):151

check for final String topLevelBaseDirStr = PropertyUtils.getProperty(MAVEN_TOP_LEVEL_PROJECT_BASEDIR);

This value is not set, no matter what you do, except for passing the property manually.

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions