maven 編譯報錯 java: -source 1.5 中不支持switch 中存在字符串



maven 編譯報錯 java: -source 1.5 中不支持switch 中存在字符串

maven項目的pom文件裏面添加

<build>
<defaultGoal>compile</defaultGoal>
<pluginManagement>
<plugins> 
<plugin> 
<groupId>org.apache.maven.plugins</groupId> 
<artifactId>maven-compiler-plugin</artifactId> 
<configuration> 
<source>1.7</source> 
<target>1.7</target> 
</configuration> 
</plugin>
</plugins>
</pluginManagement>
</build>

 

 

可以在本地的setting文件裏面添加

 

<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>

 

配置文件修改編譯格式

 

即可用JDK1.7編譯!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章