Maven Compiler Plugin
  1. Maven Compiler Plugin
  2. MCOMPILER-62

Allow multiple options to be passed to compiler for options not supported by the compiler mojo

    Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Maven version: 2.0.7
    • Number of attachments :
      3

      Description

      Look at the mail thread in maven user group:
      http://www.nabble.com/Not-able-to-pass-multiple-arguments-to-javac-tf4857909s177.html

      User may have to pass options to the underlying compiler that are not yet supported by the mojo. Current implementation of the maven-compiler-plugin allows user to specify only one option. Neither of the following techniques work:
      <configuration>
      <compilerArgument>-proc:none</compilerArgument>
      <compilerArgument>-implicit</compilerArgument>
      </configuration>

      or

      <configuration>
      <compilerArgument>-proc:none -impicit</compilerArgument>
      </configuration>

      In the first approach, only one of the compilerArgument is considered, in the second approach since maven quotes the argument, it ends up as a single argument to javac and hence becomes an invalid option.

      The best suggestion is to allow multiple compilerArgument – may be something like:
      <compilerArguments>
      <compilerArgument/>
      <compilerArgument/>
      </compilerArguments>

      1. MCOMPILER-62.patch
        0.9 kB
        Igor Vaynberg
      2. MCOMPILER-62-2.3.2.patch
        0.8 kB
        Artem Melentyev
      3. MCOMPILER-62-2.3.2.patch
        0.9 kB
        Artem Melentyev

        Issue Links

          Activity

          Hide
          Artem Melentyev added a comment -

          here is updated MCOMPILER-62.patch for 2.3.2 version.
          Also if you tired to wait, you can use my repo:

            <pluginRepositories>
              <pluginRepository>
                <id>am</id>
                <url>https://bitbucket.org/amelentev/mvnrepo/raw/tip/</url>
              </pluginRepository>
            </pluginRepositories>
          

          And use <version>2.3.2-fix62</version> of maven-compiler-plugin

          Show
          Artem Melentyev added a comment - here is updated MCOMPILER-62 .patch for 2.3.2 version. Also if you tired to wait, you can use my repo: <pluginRepositories> <pluginRepository> <id>am</id> <url>https: //bitbucket.org/amelentev/mvnrepo/raw/tip/</url> </pluginRepository> </pluginRepositories> And use <version>2.3.2-fix62</version> of maven-compiler-plugin
          Hide
          Artem Melentyev added a comment -

          update patch to use StringUtils.split. support all whitespace chars.

          Show
          Artem Melentyev added a comment - update patch to use StringUtils.split. support all whitespace chars.
          Hide
          Jesse Glick added a comment -

          "It won't break any existing pom files." - if you intentionally had <compilerArgument>-Akey=value with spaces</> that would be broken, if I understand the intent of the patch correctly.

          Show
          Jesse Glick added a comment - "It won't break any existing pom files." - if you intentionally had <compilerArgument>-Akey=value with spaces</> that would be broken, if I understand the intent of the patch correctly.
          Hide
          Stéphane Nicoll added a comment -

          there's a thread that is referring to this issue regarding annotation processors but there is a separate option for that since 2.2

          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <annotationProcessors>
                <annotationProcessor>
                  org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor
                </annotationProcessor>
              </annotationProcessors>
            </configuration>
          </plugin>
          
          Show
          Stéphane Nicoll added a comment - there's a thread that is referring to this issue regarding annotation processors but there is a separate option for that since 2.2 <plugin> <artifactId> maven-compiler-plugin </artifactId> <configuration> <annotationProcessors> <annotationProcessor> org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor </annotationProcessor> </annotationProcessors> </configuration> </plugin>
          Hide
          Christian Semrau added a comment -

          I just noted that the documentation at
          http://maven.apache.org/plugins/maven-compiler-plugin/examples/pass-compiler-arguments.html
          is currently telling me that giving multiple arguments as the value of a <compilerArgument> element is valid, which is not true.

          "For such arguments, the Compiler Plugin's compilerArguments will be used." Note the plural, which is not used in the following code snippet!

          pass-compiler-arguments.html
          ...
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-compiler-plugin</artifactId>
                  <version>2.3.2</version>
                  <configuration>
                    <compilerArgument>-verbose -bootclasspath ${java.home}\lib\rt.jar</compilerArgument>
                  </configuration>
                </plugin>
          
          Show
          Christian Semrau added a comment - I just noted that the documentation at http://maven.apache.org/plugins/maven-compiler-plugin/examples/pass-compiler-arguments.html is currently telling me that giving multiple arguments as the value of a <compilerArgument> element is valid, which is not true. "For such arguments, the Compiler Plugin's compilerArguments will be used." Note the plural, which is not used in the following code snippet! pass-compiler-arguments.html ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <compilerArgument>-verbose -bootclasspath ${java.home}\lib\rt.jar</compilerArgument> </configuration> </plugin>

            People

            • Assignee:
              Unassigned
              Reporter:
              Sanjeeb Sahoo
            • Votes:
              21 Vote for this issue
              Watchers:
              21 Start watching this issue

              Dates

              • Created:
                Updated: