[英]How can I switch the bytecode target level in IntelliJ using Maven 3 profiles
我正在使用maven配置文件在Intelli J中的兩個“設置”之間切換。如何切換字節碼目標級別? 那就是:我想在compiler.xml中更改以下設置
<bytecodeTargetLevel>
<module name="finmath-lib" target="1.6" />
</bytecodeTargetLevel>
注意:我嘗試通過相應的Maven 3配置文件中的以下部分執行此操作
<profile>
<id>java-8</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</profile>
但這不起作用!
注意:pom.xml等屬於finmath lib項目,如果您有興趣,可以在www.finmath.net找到它。
我正在使用IntelliJ IDEA 14.1.3 ,它可以使用以下配置...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
希望這是有幫助的。 謝謝!
問題是您要將其更改為1.8。
我已經嘗試使用Maven配置文件成功切換IntelliJ的編譯器版本在1.7和1.6或1.5之間。
但是,當您要將其更改為1.8時,將忽略配置。
我不知道這是maven的問題還是Intellj的問題。 看來JDK 1.8現在得不到很好的支持,這是可以理解的。
您可以在IntelliJ中打開Maven項目工具窗口,然后從列表中選擇要使用的配置文件。
在IntelliJ 13, File > Project Structure
,將Project language level
設置為8.0。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.