kikulikov
kikulikov

Reputation: 2583

Maven build deprecation error

I try to build a java project with maven. I use java 7 but maven source is 1.6. I can't change it. When I run "mvn clean install" it fails with a strange error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project search: Compilation failure
[ERROR] could not parse error message: warning: [options] bootstrap class path not set in conjunction with -source 1.6
[ERROR] /someClassName.java:114: warning: [deprecation] LUCENE_36 in Version has been deprecated
[ERROR] out = new ICUCollationKeyAnalyzer(Version.LUCENE_36, l);
[ERROR] ^
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project search: Compilation failure
could not parse error message: warning: [options] bootstrap class path not set in conjunction with -source 1.6
/someClassName.java:114: warning: [deprecation] LUCENE_36 in Version has been deprecated
                    out = new ICUCollationKeyAnalyzer(Version.LUCENE_36, l);

Currently, I am not going to change a lucene version as maven recommends.. So, I wonder why maven cares about deprecated things in the code and how to avoid these errors? Thanks.

Apache Maven 3.0.4
Java version: 1.7.0_25, vendor: Oracle Corporation

Upvotes: 6

Views: 13299

Answers (3)

Johnny
Johnny

Reputation: 15413

To elaborate on this topic a bit, you can use showWarnings configuration to force showing compilation warnings on/off.

Set it to false (if it suits you) to hide the warning in the first place.

<plugins>
    <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
            <source>1.8</source>
            <target>1.8</target>
            <showWarnings>false</showWarnings>
        </configuration>
    </plugin>
</plugins>

Upvotes: 1

kikulikov
kikulikov

Reputation: 2583

Ok. Thank you all. I resolved the problem adding SuppressWarning("deprecation") to the problem class. But still not sure what difference it makes for maven..

Upvotes: 1

artbristol
artbristol

Reputation: 32407

The error message is misleading - it's only a compilation warning, not a failure. This might be related to http://jira.codehaus.org/browse/MCOMPILER-179. Try upgrading to Maven 3.0.5 (or the latest 3.1.x) or updating the version of the maven compiler plugin in the POM.

Upvotes: 3

Related Questions