[MCOMPILER-462] Modular Multi-Release JAR and Maven-Bundle-Plugin together cause inconsistent compilation behavior
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- build-system, tooling
Research direction
Start with the attached ModularMRJAR reproducer, especially its pom and the compile-java11 execution. Run the three listed package commands with -X and compare the classpath, modulepath, and compiler options between incremental and clean builds. Done means the second and third runs compile identically when a new class is added.
Written by the indexing model from the issue text.
Description
Anand Beh opened MCOMPILER-462 and commented
Building a project with a module descriptor placed in a multi-release directory, and in conjunction with the maven-bundle-plugin, creates discrepancies between "clean package" and "package" after changes have been made to the source tree.
This is best explained by reproducing the issue.
Reproducer
Attached to this issue. Also clonable from https://github.com/A248/ModularMRJAR
Steps to reproduce
- Download the attached reproducer
- First Run: Run mvn package
- Add a new class, e.g. "Clazz2" in src/main/java/org/mrjar
- Second Run: Run mvn package
- Third Run: Run mvn clean package
The Second Run can be repeated any number of times. It will consistently fail with the reason that the org.mrjar package is not found.
Results
- First Run - compilation success
- Second Run - failure
- Third Run - success
The Third Run and the Second Run should compile identically.
Analysis
The difference between the second run and the third run is visible using the -X option.
The trouble happens when compiling the MR classes - i.e., the compile-java11 execution defined in the reproducer's pom.
On the second run, the non-MR classes are placed on the modulepath. The MR classes fail to compile:
[DEBUG] Classpath:
[DEBUG] Modulepath:
[DEBUG] /Users/anandbeh/git/ModularMRJAR/target/classes
[DEBUG] Source roots:
[DEBUG] /Users/anandbeh/git/ModularMRJAR/src/main/java11
[DEBUG] Command line options:
[DEBUG] -d /Users/anandbeh/git/ModularMRJAR/target/classes/META-INF/versions/11 --module-path /Users/anandbeh/git/ModularMRJAR/target/classes: -sourcepath /Users/anandbeh/git/ModularMRJAR/src/main/java11:/Users/anandbeh/git/ModularMRJAR/target/generated-sources/annotations: -s /Users/anandbeh/git/ModularMRJAR/target/generated-sources/annotations -g -nowarn --release 11 -encoding UTF-8 --module-version 0.1.0-SNAPSHOT
On the third run, the non-MR classes are placed on the classpath. The MR classes compile. It is further notable that the compiler command line options differ:
[DEBUG] Classpath:
[DEBUG] /Users/anandbeh/git/ModularMRJAR/target/classes
[DEBUG] Source roots:
[DEBUG] /Users/anandbeh/git/ModularMRJAR/src/main/java11
[DEBUG] Command line options:
[DEBUG] -d /Users/anandbeh/git/ModularMRJAR/target/classes/META-INF/versions/11 -classpath /Users/anandbeh/git/ModularMRJAR/target/classes: -sourcepath /Users/anandbeh/git/ModularMRJAR/src/main/java11:/Users/anandbeh/git/ModularMRJAR/target/generated-sources/annotations: -s /Users/anandbeh/git/ModularMRJAR/target/generated-sources/annotations -g -nowarn --release 11 -encoding UTF-8 --patch-module org.mrjar=/Users/anandbeh/git/ModularMRJAR/target/classes --module-version 0.1.0-SNAPSHOT
How to Resolve / Lesson from when not using the maven-bundle-plugin
If the maven-bundle-plugin were to NOT be used, then:
- The Second Run would succeed.
- The non-MR classes are placed on the class-path consistently.
This suggests the behavior of the Second Run in placing the non-MR classes on the module-path is incorrect. The Second Run should place the non-MR classes on the class-path just like the Third Run does.
Affects: 3.8.1
Attachments:
- ModularMRJAR.zip (41.89 kB)
- Dominant language
- Java
- Stars
- 261
- Forks
- 194
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 17
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/maven-compiler-plugin
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
apache/maven-compiler-plugin#1148 · 2 comments ·
Maintainers usually reply within 1 day
-
3.x bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
apache/maven-compiler-plugin#1140 · 1 comment ·
Maintainers usually reply within 1 day
-
3.x enhancement
Difficulty 3/5 1-2 days Newbie friendliness 68/100
apache/maven-compiler-plugin#1138 ·
Maintainers usually reply within 1 day
-
3.x bug
Difficulty 4/5 3-5 days Newbie friendliness 64/100
apache/maven-compiler-plugin#1137 ·
Maintainers usually reply within 1 day
-
3.x bug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
apache/maven-compiler-plugin#1124 · 1 comment · 3 reactions ·
Maintainers usually reply within 1 day
All issues in apache/maven-compiler-plugin
Similar issues
-
status: waiting-for-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
AOT compilation fails for derived delete queries returning SetPossibly taken @ryujungkyun claimed this today. Openstatus: waiting-for-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
spring-projects/spring-data-jpa#4387 ·
Maintainers usually reply within 3 days
-
[Bug] System alert time picker no longer applies start-only or end-only filtersPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/rocketmq-dashboard#6636 ·
Maintainers usually reply within 3 days