maven在编译时提示以下信息:编码GBK的不可映射字符
我们直接将项目改为UTF-8编码,再次尝试编译发现问题仍未解决。那我们就需要在pom.xml文件中,指定当前项目的文件格式来解决这个问题。
方案一:
在pom.xml的/project/build/plugins/下的编译插件声明中加入下面的配置:UTF-8
即:
1 2 3 4 5 6 7 8 9 10
   | <plugin>     <groupId>org.apache.maven.plugins</groupId>	     <artifactId>maven-compiler-plugin</artifactId>     <version>3.1</version>     <configuration>         <source>1.7</source>         <target>1.7</target>         <encoding>UTF-8</encoding>     </configuration> </plugin>
   | 
 
方案二:
在pom.xml的/project/properties/下的属性配置中加入下面的配置:
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
即:(有第一句即可)
1 2 3 4
   | <properties>     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>     <maven.compiler.encoding>UTF-8</maven.compiler.encoding> </properties>
   | 
 
引用
maven错误解决:编码GBK的不可映射字符