apache / apache/maven-compiler-plugin
[MCOMPILER-291] No possible use compilerArgs arg "-J--add-opens" multiple times
- Dominant language
- Java
- Stars
- 261
- Forks
- 191
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 8
Description
**[Pascal Schumacher](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=pascalschumacher)** opened **[MCOMPILER-291](https://issues.apache.org/jira/browse/MCOMPILER-291?redirect=false)** and commented
I'm trying to a project with uses lombok to work with java 9.
```
org.apache.maven.plugins
maven-compiler-plugin
3.6.1
1.8
1.8
true
-J--add-opens-Jjdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
-J--add-opens-Jjdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
-J--add-opens-Jjdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
-J--add-opens-Jjdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
-J--add-opens-Jjdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
-J--add-opens-Jjdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
-J--add-opens-Jjdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
-J--add-opens-Jjdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
-J--add-opens-Jjdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
```
```
mvn -X compile
``` shows me that the
```-J--add-opens
``` arguments are collapsed:
```
cmd.exe /X /C ""C:\Program Files\Java\jdk-9\bin\javac.exe" `@C`:/Users/User/random-beans/random-beans/target/classes/org.codehaus.plexus.compiler.javac.JavacCompiler9403484282707867963arguments -J--add-opens -Jjdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED -Jjdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED"
```
which results in:
```
Error: Main Class jdk.compiler.com.sun.tools.javac.util=ALL-UNNAMED could not be found or load
```
```
---
**Affects:** 3.6.1
6 votes, 6 watchers
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing how the Maven compiler plugin handles the repeated compilerArgs entries shown in the issue, then reproduce the behavior with `mvn -X compile` on Java 9. Done means repeated `-J--add-opens` options remain correctly paired with their values so the compilation command no longer treats a later option as a main class.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100