[
https://issues.apache.org/jira/browse/MCOMPILER-279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17224537#comment-17224537
]
Marc Eilens edited comment on MCOMPILER-279 at 11/2/20, 9:43 AM:
-----------------------------------------------------------------
Hi,
I'm currently experiencing the originally mentioned bug behaviour when using
the plugin in combination with the eclipse compiler.
One --add-exports argument is ok, but the second isn't processed correctly.
{code:java}
// Code-Platzhalter
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>9</source>
<target>9</target>
<compilerId>eclipse</compilerId>
<compilerArgs>
<arg>--add-exports</arg>
<arg>java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED</arg>
<arg>--add-exports</arg>
<arg>java.xml/com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED</arg>
</compilerArgs>
</configuration>
</plugin>{code}
This is the error message:
{noformat}
Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile)
on project guibasecommon: Fatal error compiling{noformat}
and some details:
{noformat}
[DEBUG] ecj command line: [-noExit, -preserveAllLocals, -g:lines,vars,source,
-source, 9, -target, 9, -encoding, cp1252, -warn:none, --add-exports,
java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED,
java.xml/com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED,
-d,...<shortened>
[DEBUG] Unrecognized option :
java.xml\com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED{noformat}
We are using the following versions for eclipse, but also the latest versions
of these two plugins didn't make a difference.
Any help is appreciated.
{code:java}
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-eclipse</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>ecj</artifactId>
<version>3.19.0</version>
</dependency>
</dependencies>{code}
was (Author: eilensm):
Hi,
I'm currently experiencing the originally mentioned bug behaviour when using
the plugin in combination with the eclipse compiler.
One --add-exports argument is ok, but the second isn't processed correctly.
{code:java}
// Code-Platzhalter
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>9</source>
<target>9</target>
<compilerId>eclipse</compilerId>
<compilerArgs>
<arg>--add-exports</arg>
<arg>java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED</arg>
<arg>--add-exports</arg>
<arg>java.xml/com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED</arg>
</compilerArgs>
</configuration>
</plugin>{code}
This is the error message:
{noformat}
Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile)
on project guibasecommon: Fatal error compiling{noformat}
and some details:
{noformat}
[DEBUG] ecj command line: [-noExit, -preserveAllLocals, -g:lines,vars,source,
-source, 9, -target, 9, -encoding, cp1252, -warn:none, --add-exports,
java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED,
java.xml/com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED,
-d,...<shortened>
[DEBUG] Unrecognized option :
java.xml\com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED{noformat}
We are using the following versions for eclipse, but also the latest versions
of these two plugins didn't make a difference.
Any help is appreciated.
{code:java}
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-eclipse</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>ecj</artifactId>
<version>3.19.0</version>
</dependency>
</dependencies>{code}
> Passing multiple --add-exports args to the compilerArgs is not supported
> ------------------------------------------------------------------------
>
> Key: MCOMPILER-279
> URL: https://issues.apache.org/jira/browse/MCOMPILER-279
> Project: Maven Compiler Plugin
> Issue Type: Bug
> Affects Versions: 3.5.1
> Reporter: Michael Musgrove
> Assignee: Robert Scholte
> Priority: Major
> Fix For: 3.6.0
>
> Attachments: jdk9-test.tar
>
>
> This plugin collapses multiple compiler args with the same name into a single
> one.
> An example of where this is an issue is when exporting extra packages from a
> Java SE 9 module:
> Suppose we want to export two packages (package1 and package2) from a module
> called FROM-MOD to the OTHER-MOD module. The syntax for this is:
> {code}
> javac ... --add-exports FROM-MOD/package1=OTHER-MOD --add-exports
> FROM-MOD/package2=OTHER-MOD
> {code}
> and the plugin configuration for this is:
> {code:xml}
> <configuration>
> ...
> <compilerArgs>
> <arg>--add-exports</arg>
> <arg>FROM-MOD/package1=OTHER-MOD</arg>
> <arg>--add-exports</arg>
> <arg>FROM-MOD/package2=OTHER-MOD></arg>
> <compilerArgs>
> </configuration>
> {code}
> which produces:
> {code}
> javac ... --add-exports FROM-MOD/package1=OTHER-MOD
> FROM-MOD/package2=OTHER-MOD
> {code}
> Notice the missing --add-exports for the second export so the compiler
> complains with the error:
> bq. Caused by: java.lang.IllegalArgumentException: invalid flag:
> java.corba/com.sun.corba.se.spi.ior=ALL-UNNAMED
> A concrete but basic example maven project is attached.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)