You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "mehdi dabboussi (Jira)" <ji...@apache.org> on 2020/03/02 16:31:00 UTC
[jira] [Commented] (MCOMPILER-279) Passing multiple --add-exports
args to the compilerArgs is not supported
[ https://issues.apache.org/jira/browse/MCOMPILER-279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17049389#comment-17049389 ]
mehdi dabboussi commented on MCOMPILER-279:
-------------------------------------------
In order to export two packages as per the updated configuration, I tried to specify two _\-\-add-exports_ arguments within the _<compilerArguments>_ configuration element while this option does not work as the final compiler argument will be *_\-add--exports_* and not *_\-\-add--exports_*.
Here down the configuration used:
{code:xml}
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
<compilerArgs>
<add-exports>java.desktop/com.sun.java.swing.plaf.motif.resources=ALL-UNNAMED</add-exports>
<add-exports>java.desktop/com.sun.java.swing.plaf.windows.resources=ALL-UNNAMED</add-exports>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
{code}
I can found no documentation specifying how to use a double (or multiple) package export within the _maven-compiler-plugin_ usage guide.
> 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)