2013-02-05 31 views
9

我正在使用Maven 2.x,Atlassian Bamboo與maven插件我的構建jdk配置設置爲1.6,我沒有任何jdk版本在pom中強制執行設置.xml文件。源1.3(使用源5或更高來啓用泛型)

當我在我的IDE編譯項目,它工作正常,但是當我在竹編譯它給我下面的錯誤。

我已經檢查了我在任務中配置的jdk版本是1.6,我也嘗試從pom中的maven插件強制執行jdk版本,但沒有工作。你們有人可能知道這裏發生了什麼?

[INFO] ------------------------------------------------------------------------ 
[ERROR] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Compilation failure 

in -source 1.3 
(use -source 5 or higher to enable generics) 
     List<String> matchedList = findMatchPhrase(keyword, expression); 


[INFO] ------------------------------------------------------------------------ 
[INFO] For more information, run Maven with the -e switch 

回答

15

將以下屬性添加到您的pom.xml

<properties> 
    <maven.compiler.target>1.6</maven.compiler.target> 
    <maven.compiler.source>1.6</maven.compiler.source> 
</properties> 
+0

真棒作品給我。 –

+1

上個星期我遇到完全相同的問題時,你問這個問題很有趣:) – adarshr

1

不涉及修改POM是指定在命令行的源和目標的另一種方法:

mvn install -Dmaven.compiler.source=1.6 -Dmaven.compiler.target=1.6 

注意,這通常應該避免,因爲構建不能保證可以這樣重複。

相關問題