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

Javac compiler plugin doesn't support -Werror

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1
    • 2.4
    • None

    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.

      Attachments

        1. JavacCompiler.java
          29 kB
          Alex Ioffe
        2. JavacCompiler.patch
          0.6 kB
          Alex Ioffe
        3. trial-maven.zip
          20 kB
          Martin Ackermann
        4. werror.zip
          5 kB
          Alex Ioffe

        Issue Links

          Activity

            People

              krosenvold Kristian Rosenvold
              cwebster Chris Webster
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: