Uploaded image for project: 'Maven Compiler Plugin'
  1. Maven Compiler Plugin
  2. MCOMPILER-279

Passing multiple --add-exports args to the compilerArgs is not supported

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.5.1
    • 3.6.0
    • None

    Description

      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:

      javac ... --add-exports FROM-MOD/package1=OTHER-MOD --add-exports FROM-MOD/package2=OTHER-MOD
      

      and the plugin configuration for this is:

      <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>
      

      which produces:

      javac ... --add-exports FROM-MOD/package1=OTHER-MOD FROM-MOD/package2=OTHER-MOD
      

      Notice the missing --add-exports for the second export so the compiler complains with the error:

      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.

      Attachments

        1. jdk9-test.tar
          10 kB
          Michael Musgrove

        Activity

          People

            rfscholte Robert Scholte
            mmusgrov Michael Musgrove
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: