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

Regression mvnd 1.0-m6 vs. mvn 3.9.1 #841

Closed
hgschmie opened this issue Apr 25, 2023 · 7 comments
Closed

Regression mvnd 1.0-m6 vs. mvn 3.9.1 #841

hgschmie opened this issue Apr 25, 2023 · 7 comments
Assignees
Milestone

Comments

@hgschmie
Copy link

mvnd --version
Apache Maven Daemon (mvnd) 1.0-m6 darwin-aarch64 native client (47d4c6b9c399079d91312bb8ae35d1d76e7fd97a)
Terminal: org.jline.terminal.impl.PosixSysTerminal with pty org.jline.terminal.impl.jansi.osx.OsXNativePty
Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)
Maven home: /opt/homebrew/Cellar/mvnd/1.0-m6-m39/libexec/mvn
Java version: 17.0.6, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "13.3.1", arch: "aarch64", family: "mac"
mvn --version
Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)
Maven home: /opt/homebrew/Cellar/maven/3.9.1/libexec
Java version: 17.0.6, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "13.3.1", arch: "aarch64", family: "mac"

how to reproduce:

% git clone [email protected]:jdbi/jdbi
% cd jdbi
% git checkout v3.38.0-rc3
% mvnd -pl :jdbi3-core -am clean install
[...]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for jdbi3 build parent 3.38.0-rc3:
[INFO]
[INFO] jdbi3 - internal - policy .......................... SUCCESS [  1.670 s]
[INFO] jdbi3 - internal - build parent .................... FAILURE [  0.095 s]
[INFO] jdbi3 build parent ................................. SKIPPED
[INFO] jdbi3 core ......................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.828 s (Wall Clock)
[INFO] Finished at: 2023-04-24T20:23:59-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.2.1:enforce (enforce-jdbi) on project jdbi3-build-parent:
[ERROR] Rule 1: org.apache.maven.enforcer.rules.property.RequireProperty failed with message:
[ERROR] This module must set a moduleName.
[ERROR] -> [Help 1]

Same command with mvn works fine.

Given the way our project sets module names (we use per-module profile activation based on the presence and absence of files in the directories), the most likely culprit is some sort of caching of profile activation. The correct list of profile activations would be:

Active Profiles for Project 'org.jdbi.internal:jdbi3-policy:jar:3.38.0-rc3':

The following profiles are active:




Active Profiles for Project 'org.jdbi.internal:jdbi3-build-parent:pom:3.38.0-rc3':

The following profiles are active:

 - in-parent (source: org.jdbi.internal:jdbi3-build-parent:3.38.0-rc3)
 - macos arm (source: org.jdbi.internal:jdbi3-build-parent:3.38.0-rc3)



Active Profiles for Project 'org.jdbi:jdbi3-parent:pom:3.38.0-rc3':

The following profiles are active:

 - java17 (source: org.jdbi:jdbi3-parent:3.38.0-rc3)
 - in-parent (source: org.jdbi.internal:jdbi3-build-parent:3.38.0-rc3)
 - macos arm (source: org.jdbi.internal:jdbi3-build-parent:3.38.0-rc3)



Active Profiles for Project 'org.jdbi:jdbi3-core:jar:3.38.0-rc3':

The following profiles are active:

 - java17 (source: org.jdbi:jdbi3-parent:3.38.0-rc3)
 - macos arm (source: org.jdbi.internal:jdbi3-build-parent:3.38.0-rc3)
 - basepom.invoker-reporting (source: org.basepom:basepom-oss:52)
 - basepom.invoker-integration-testing (source: org.basepom:basepom-foundation:52)

The in-parent profile provides a module name. Running the same command with mvnd yields no output (!).

output of mvnd -X -pl :jdbi3-core -am clean install

logfile-mvnd.txt

output of mvn -X -pl :jdbi3-core -am clean install

logfile-mvn.txt

@hgschmie
Copy link
Author

hgschmie commented May 6, 2023

pretty ping?

@hgschmie
Copy link
Author

hgschmie commented May 6, 2023

Quick update: I built the current trunk from scratch with

openjdk 17.0.6 2023-01-17
OpenJDK Runtime Environment GraalVM CE 22.3.1 (build 17.0.6+10-jvmci-22.3-b13)
OpenJDK 64-Bit Server VM GraalVM CE 22.3.1 (build 17.0.6+10-jvmci-22.3-b13, mixed mode, sharing)

and tried both the m39 and m40 variants. Same result. So this is a problem that still exists in the current version and it is not confined specifically to maven 3.9 or maven 4.0

@hgschmie
Copy link
Author

hgschmie commented May 6, 2023

This also fails only with the smart builder. When using --builder=singlethreaded or --builder=multithreaded, the build succeeds.

@electrum
Copy link

electrum commented May 9, 2023

@hgschmie thanks for tracking this down and filing the issue. We've been hitting this as well. I can confirm that putting mvnd.builder=multithreaded in my ~/.m2/mvnd.properties file works around the issue for me.

@gnodet
Copy link
Contributor

gnodet commented May 10, 2023

So this problem is caused by a combination of two factors:

  • mvnd caches the realm, this is usually not a problem, but it is in the case of enforcer
  • the problem happens only if the modules are built in a given order

What happens is that when the first module is built, the enforcer loads the rules, including the requireProperty one. The first execution works fine. However, during the second execution, the enforcer does not reload the rules, thereby executing the rule which should not be configured, hence the failure.

@gnodet
Copy link
Contributor

gnodet commented May 10, 2023

My analysis was wrong. The problem seems to come from the MavenSession injected into plexus components for the enforcer realm, which does not point to the correct project.

@gnodet
Copy link
Contributor

gnodet commented May 10, 2023

The fix is available at takari/takari-smart-builder#25

@gnodet gnodet added this to the 1.0-m7 milestone May 11, 2023
gnodet added a commit to gnodet/mvnd that referenced this issue May 11, 2023
@gnodet gnodet self-assigned this May 16, 2023
gnodet added a commit to gnodet/mvnd that referenced this issue Jun 20, 2023
@gnodet gnodet closed this as completed in bf981d6 Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants