Non-mapped characters of the MAVEN install hint encoding GBK in eclipse

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.