2015年2月4日 星期三

[Bug] maven...not supported in -source 1.x

如果在對maven做install時,出現類似
maven strings in switch are not supported in -source 1.5
以此類推
maven balabalabalabalabala not supported in -source 1.x

但電腦環境變數設定的jdk是1.7無誤

1.檢查是否手殘以至於maven找不到JAVA_HOME
在令命提示字元裡下mvn -version觀看maven的JAVA_HOME抓到的值


若結果也是1.7無誤

2.檢查pom.xml檔
首先檢看build tag中是否有以下設定
若無則加上去
build tag是在project tag中

<build>
    <plugins>
       <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>2.3.1</version>
           <configuration>
               <source>1.7</source>
               <target>1.7</target>
           </configuration>
       </plugin>
    </plugins>
 </build>
另一種方法為
<properties>tag中加入

<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>


沒有留言:

張貼留言