mvn 编译失败 不支持string swich

今天碰到一个maven编译失败的问题:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project EsaCsvReport: Compilation failure
erro: strings in switch are not supported in -source 1.5

解决方法:
(1)找到maven.home
(2)在maven.home/conf下打开settings.xml,找profiles节点,添加
    <profile> 
    <id>jdk-1.7</id> 
     <activation> 
          <activeByDefault>true</activeByDefault> 
          <jdk>1.7</jdk> 
      </activation> 
      <properties> 
          <maven.compiler.source>1.7</maven.compiler.source> 
          <maven.compiler.target>1.7</maven.compiler.target> 
<maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
      </properties> 
    </profile>
(3)再次执行mvn install就好了  

猜你喜欢

转载自hetaoii.iteye.com/blog/2234426
mvn