2015-05-07 203 views
0

我有一個錯誤Error:java: javacTask: source release 8 requires target release 1.8。我用1.8的java語言級別設置爲8。我想可能是這個原因的唯一事情是在pom.xml文件項目編譯錯誤版本8需要目標1.8版本

  <configuration> 
       <executable>${java.home}/bin/java</executable> 
       <commandlineArgs>${runfx.args}</commandlineArgs> 
     </configuration> 

此行

<commandlineArgs>${runfx.args}</commandlineArgs> 

線是紅色的,哪些要做到這一點,我無法設法得到。

+0

您需要在您的pom.xml中明確地將編譯器級別設置爲1.8 – CKing

回答

1

設置在Maven的編譯器的版本,你會的東西,看起來像這樣在你的pom.xml文件:

<build> 
    <pluginManagement> 
     <plugins> 
      <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> 
     </plugins> 
    </pluginManagement> 
</build> 

3.3是最新的Maven編譯器插件版本。我認爲這是Java 8支持所需要的。

這是same as setting the -source and -target compiler options

+0

原來我在這裏有一個Java 6的例子,但是我決定將它更新到Java 8,因爲它更相關。 – Powerlord

相關問題