maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aliaksei Lahachou <aliaksei.lahac...@gmail.com>
Subject Compiler warnings treated as errors
Date Wed, 24 Jul 2013 08:48:53 GMT
Hello all,

I think this problem was already discussed here, but I cannot find it. My
problem is that sometimes compiler warnings are treated as errors. For
example:

[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile
(default-compile) on project <...>: Compilation failure: Compilation
failure:
[ERROR] <...>\ImageCaptchaServlet.java:[14,31]
com.sun.image.codec.jpeg.JPEGCodec is Sun proprietary API and may be
removed in a future release
[ERROR] <...>\ImageCaptchaServlet.java:[15,31]
com.sun.image.codec.jpeg.JPEGImageEncoder is Sun proprietary API and may be
removed in a future release

This is not a problem with m-compiler-p version 2.3.2, but it is a problem
in all newer versions (I tried 2.4, 2.5, 2.5.1, 3.0, 3.1).

This behavior seems to be unstable. The source from the example was
compiled successfully, when they were a part of other Maven module. When I
moved it to another module after refactoring, I could not compile it any
more. Both modules are inherited from the same parent and have the same
m-compiler-p configuration (I also compared effective POMs).

I tried building trunk version of m-compiler-p. There, the
CompilerMojoTestCase.testCompilerFork test fails, and it seems to me for
the same reason:

testCompilerFork(org.apache.maven.plugin.compiler.CompilerMojoTestCase)
Time elapsed: 0.09 sec  <<< ERROR!
org.apache.maven.plugin.compiler.CompilationFailureException: Compilation
failure
    at
org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:862)
    at
org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
    at
org.apache.maven.plugin.compiler.CompilerMojoTestCase.testCompilerFork(CompilerMojoTestCase.java:160)


The following code seems a bit strange to me. Why does it throw a
compilation failure exception when there are warnings?

            if ( !errors.isEmpty() )
            {
                throw new CompilationFailureException( errors );
            }
            else
            {
                throw new CompilationFailureException( warnings );
            }

My environment is Windows 7 x64, Oracle JDK 1.6.0_45.

Is this a known problem? Is there a workaround for it? (other than using
version 2.3.2 version of m-compiler-p)

Regards,
htfv (Aliaksei Lahachou)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message