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

Quarkus Build with Maven Artefact Resolver Configuration Options #44484

Closed
chbieri opened this issue Nov 13, 2024 · 5 comments · Fixed by #45794
Closed

Quarkus Build with Maven Artefact Resolver Configuration Options #44484

chbieri opened this issue Nov 13, 2024 · 5 comments · Fixed by #45794
Labels
area/maven kind/bug Something isn't working
Milestone

Comments

@chbieri
Copy link

chbieri commented Nov 13, 2024

Describe the bug

We use Maven with the quarkus-maven-plugin to build Quarkus applications on our CI system.

To improve caching, we attempted to use the enhanced local repository management (LRM) feature by separating the local repository for snapshots and releases (see Maven Local Repository Documentation).

Following the configuration guide here, we specified the following properties in the settings.xml:

<settings ...>
...
    <profiles>
	<profile>
            <id>split-repository</id>
            <properties>
                <aether.enhancedLocalRepository.split>true</aether.enhancedLocalRepository.split>
                <aether.enhancedLocalRepository.splitLocal>true</aether.enhancedLocalRepository.splitLocal>
                <aether.enhancedLocalRepository.splitRemote>true</aether.enhancedLocalRepository.splitRemote>
            </properties>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>split-repository</activeProfile>
    </activeProfiles>
</settings>

Expected behavior

The quarkus-maven-plugin or quarkus-maven-resolver should support all Maven artifact resolver options as outlined in this documentation.

Actual behavior

For most of the build process, this configuration works as expected, with artifacts resolving to either ~/.m2/repository/cached/releases or ~/.m2/repository/cached/snapshots.

However, during the quarkus:3.8.6:generate-code-tests phase, the build starts resolving all dependencies again under ~/.m2/repository/. We also attempted unsuccessfully to set these options in a .mvn/.jvm.config file in the project root.

Could you confirm if the quarkus-maven-plugin or quarkus-maven-resolver fully supports all Maven artifact resolver options?

How to Reproduce?

To reproduce this issue:

  1. Configure Maven's settings.xml as shown above to split the local repository for snapshots and releases.
  2. Add a sample Quarkus project with the quarkus-maven-plugin in the pom.xml, using version 3.8.6 or 3.15.1.
  3. delete ~/.m2/repository/
  4. Run the build command:
    mvn clean install

Observe that during the generate-code-tests phase, dependencies are unexpectedly resolved under ~/.m2/repository/ instead of the configured split directories.

Output of uname -a or ver

No response

Output of java -version

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

@chbieri chbieri added the kind/bug Something isn't working label Nov 13, 2024
Copy link

quarkus-bot bot commented Nov 13, 2024

/cc @quarkusio/devtools (maven), @radcortez (config)

@geoand
Copy link
Contributor

geoand commented Nov 28, 2024

cc @aloubyansky

@Ladicek
Copy link
Contributor

Ladicek commented Jan 16, 2025

I can confirm that this still happens on the main branch (999-SNAPSHOT). Moreover, it's not just the generate-code-tests mojo, it's also the @QuarkusTest that doesn't respect the configured repository split. I'd say both of them are a bug (not sure if the same bug, will see).

EDIT: and it's also the Quarkus dev mode (mvn clean quarkus:dev).

@aloubyansky
Copy link
Member

I'm wondering whether passing them as system properties would have an effect.

@Ladicek
Copy link
Contributor

Ladicek commented Jan 22, 2025

Passing the configuration as system properties wasn't enough, I had to fix the initialization process for the repository session to use all configuration (including from active profiles from settings.xml) to build the local repo manager. In the PR, I actually made the method to create the repository session to almost be a copy of the corresponding code in Maven; it's already been like that, mostly, but not quite. There might have been reasons for some differences, so maybe we can discuss that in the PR.

@quarkus-bot quarkus-bot bot added this to the 3.19 - main milestone Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/maven kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants