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

Javac compiler plugin doesn't support -Werror

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.4
    • Labels:
      None
    • Number of attachments :
      4

      Description

      If I write a pom file like the following:

      ...
        		<plugin>
        			<groupId>org.apache.maven.plugins</groupId>
        			<artifactId>maven-compiler-plugin</artifactId>
        			<version>2.1</version>
        			<configuration>
        			    <compilerId>javac</compilerId>
        				<source>1.6</source>
        				<target>1.6</target>
        				
        				<compilerArguments>
        					<Werror /> 
        					<Xlint:all />
        				</compilerArguments>
        				<showDeprecation>true</showDeprecation>
        			</configuration>
        		</plugin>

      and if there are only warnings, then the build will not fail as intended by the compiler Argument. The reason is that in compileInProcess the exit code from javac is only considered if there are no messages. In the case of treating warnings as errors, there will be messages but no errors so the intention of the build failure is lost.

        Issue Links

          Activity

          Hide
          Steven Schlansker added a comment -

          Kristian commented above that the Plexus compiler was fixed and that 1.8.2 was released... I can confirm that I see 1.8.2 on various Maven mirrors. Is that not sufficient? (Sorry, I don't know too much about the dependencies here, I just want to offer to go bug whoever is blocking this from getting out so I can use it!)

          Show
          Steven Schlansker added a comment - Kristian commented above that the Plexus compiler was fixed and that 1.8.2 was released... I can confirm that I see 1.8.2 on various Maven mirrors. Is that not sufficient? (Sorry, I don't know too much about the dependencies here, I just want to offer to go bug whoever is blocking this from getting out so I can use it!)
          Show
          Steven Schlansker added a comment - Ref: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler/1.8.2/plexus-compiler-1.8.2.pom
          Hide
          Steven Schlansker added a comment -

          I've sent a mail to the plexus compiler user list in the hopes that there are in fact additional issues fixed worthy of a new release.

          Show
          Steven Schlansker added a comment - I've sent a mail to the plexus compiler user list in the hopes that there are in fact additional issues fixed worthy of a new release.
          Hide
          Kristian Rosenvold added a comment - - edited

          You can add plexus-compiler manually to maven-compiler-plugin

                        <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-compiler-plugin</artifactId>
                          <dependencies>
                              <dependency>
                                  <groupId>org.codehaus.plexus</groupId>
                                  <artifactId>plexus-compiler</artifactId>
                                  <version>1.8.2</version>
                              </dependency>
                          </dependencies>
                      </plugin>
          
          Show
          Kristian Rosenvold added a comment - - edited You can add plexus-compiler manually to maven-compiler-plugin <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <dependencies> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-compiler</artifactId> <version>1.8.2</version> </dependency> </dependencies> </plugin>
          Hide
          Steven Schlansker added a comment - - edited

          Thank you, I had to do this actually:

                              <!-- Remove after we move to maven-compiler-plugin 2.4 -->
                              <dependencies>
                                <dependency>
                                  <groupId>org.codehaus.plexus</groupId>
                                  <artifactId>plexus-compiler-api</artifactId>
                                  <version>1.8.2</version>
                                  <exclusions>
                                    <exclusion>
                                      <groupId>org.codehaus.plexus</groupId>
                                      <artifactId>plexus-component-api</artifactId>
                                    </exclusion>
                                  </exclusions>
                                </dependency>
                                <dependency>
                                  <groupId>org.codehaus.plexus</groupId>
                                  <artifactId>plexus-compiler-manager</artifactId>
                                  <version>1.8.2</version>
                                  <exclusions>
                                    <exclusion>
                                      <groupId>org.codehaus.plexus</groupId>
                                      <artifactId>plexus-component-api</artifactId>
                                    </exclusion>
                                  </exclusions>
                                </dependency>
                                <dependency>
                                  <groupId>org.codehaus.plexus</groupId>
                                  <artifactId>plexus-compiler-javac</artifactId>
                                  <version>1.8.2</version>
                                  <scope>runtime</scope>
                                  <exclusions>
                                    <exclusion>
                                      <groupId>org.codehaus.plexus</groupId>
                                      <artifactId>plexus-component-api</artifactId>
                                    </exclusion>
                                  </exclusions>
                                </dependency>
                              </dependencies>
          

          but it does work now!

          Show
          Steven Schlansker added a comment - - edited Thank you, I had to do this actually: <!-- Remove after we move to maven-compiler-plugin 2.4 --> <dependencies> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-compiler-api</artifactId> <version>1.8.2</version> <exclusions> <exclusion> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-component-api</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-compiler-manager</artifactId> <version>1.8.2</version> <exclusions> <exclusion> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-component-api</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-compiler-javac</artifactId> <version>1.8.2</version> <scope>runtime</scope> <exclusions> <exclusion> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-component-api</artifactId> </exclusion> </exclusions> </dependency> </dependencies> but it does work now!

            People

            • Assignee:
              Kristian Rosenvold
              Reporter:
              Christopher Webster
            • Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: