When compiling project source code using MAVEN today in Eclipse, the result is the following error
In the Java source code does not prompt any error, even if the project code is not broken, as shown in:
The first time you encounter this problem, record it, share it.
The idea of solving this problem: to declare the correct character set encoding in MAVEN's compilation plugin-the character set encoding used by the compilation is consistent with the character set encoding used by the code file!!
After installing the system, the general Chinese system default character set is GBK. The software we install generally inherits the default character set that is used by the operating system. So when the Chinese XP or Win7 system development, when using MAVEN (MVN compile) to compile the project, there will be "encoding GBK non-mapped characters": This is due to the use of code UTF-8, and Maven compiled with the use of GBK for the sake of. By modifying the project's Pom file, you can tell Maven that the project compiles using UTF-8 encoding. Add the following configuration to the project's Pom.xml file:
<!--Specify the character encoding to use when compiling the source code, the GBK encoding that is used by default when Maven compiles, and the Project.build.sourceEncoding property to set the character encoding to tell Maven that the project uses UTF-8 to compile-- >
<properties> <project.build.sourceEncoding>utf-8</project.build.sourceEncoding> </Properties>
Or, add the following configuration to the compiler plug-in declaration under Pom.xml/project/build/plugins/:
<encoding>utf8</encoding>
Both of these solutions solve the above problems and can be set according to personal habits, as shown in the configuration <project.build.sourceEncoding> properties to indicate the character encoding used by the compilation.
Non-mapped characters of the MAVEN install hint encoding GBK in eclipse