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

Javac compiler plugin doesn't support -Werror

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.4
    • Labels:
      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. trial-maven.zip
          20 kB
          Martin Ackermann
        2. JavacCompiler.java
          29 kB
          Alex Ioffe
        3. JavacCompiler.patch
          0.6 kB
          Alex Ioffe
        4. werror.zip
          5 kB
          Alex Ioffe

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: