[英]How to configure compiler level (1.6) in maven settings.xml?
我熟悉配置 maven-compiler-plugin 以在 pom.xml 中使用 java 1.6 並使用父 pom 文件。
有沒有辦法在settings.xml級別中將java編譯器級別配置為java 1.6(這樣我所有的maven項目都將使用java 1.6)?
在這個線程默認的 maven 編譯器設置中,有人告訴有一種方法可以在 settings.xml 中配置它。 有人可以解釋一下如何配置嗎?
PS:另一種指定Java編譯器級別的方法:
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
-濕婆
簡單的答案 否。在設置文件中,您不會配置這樣的內容,因為它沒有意義,並且會使您的構建無法重現。 settings.xml 中關於配置編譯器插件的信息是垃圾。
源/目標級別可以在 settings.xml 中配置,如下所示:
<profiles>
<profile>
<id>jdk-1.6</id>
<activation>
// can be replaced with other conditions
<jdk>1.6</jdk>
</activation>
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<maven.compiler.compilerVersion>1.6</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.