2013-10-17 138 views
5

我嘗試用maven構建一個java項目。我使用java 7,但maven源代碼是1.6。我無法改變它。當我運行「命令mvn全新安裝」失敗與一個奇怪的錯誤:Maven構建棄用錯誤

[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); 

目前,我不打算爲行家建議改變Lucene的版本。所以,我不知道爲什麼行家在關心的事情已過時代碼以及如何避免這些錯誤?謝謝。

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

回答

0

好的。謝謝你們。我解決了在問題類中添加SuppressWarning("deprecation")的問題。但仍然不知道它爲maven帶來了什麼樣的差異..

1

爲了詳細闡述這個話題,你可以使用showWarnings配置強制顯示編譯警告的開啓/關閉。

將它設置爲false(如果它適合你的話)首先隱藏警告。

<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>