版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hualele/article/details/78728517
现状:maven 编译时出现 -source 7 或更高版本以允许 switch 中存在字符串错误
解决方案:
在pom.xml中追加(project中)
<build>
<finalName>cclzz</finalName>
<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>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
问题解决,但是控制台中出现了warning,
编码格式,之前resource,明明是utf-8,为什么是gbk?
解决方案:
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
pom中追加以上信息,问题解决!