Specify the character code of the source when building with Maven

Overview

Write how to specify the character code of the source when building with Maven. If you do not specify the character code of the source when building with Maven, the following Warning will be displayed.

[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!

Method

Add the following to pom.xml (when UTF-8 is specified).

<properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

The hierarchy is as follows.

<project>
  ...
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  ...
</project>

reference

Maven – Frequently Asked Technical Questions

Recommended Posts

Specify the character code of the source when building with Maven
When reading the source code
Specify the default value with @Builder of Lombok
Implement the UICollectionView of iOS14 with the minimum required code.
[Java] When writing the source ... A memorandum of understanding ①
The procedure I did when I prepared the environment of gradle + Java with VS Code (Windows 10)
[Docker] List of errors that occurred when building the environment
Temporary workaround for the problem of failing with "no code signature found." When starting the actual Xcode12
The point of addiction when performing basic authentication with Java URLConnection
[Reference example] Copyright is described in the comment of the source code.
Guess the character code in Java
I read the source of ArrayList I read
I read the source of Integer
I read the source of Long
Pre-written source code for the activity
I read the source of Short
I read the source of Byte
I read the source of String
Basic structure of Java source code
Android application: Let's explain the mechanism of screen transition with simple code
Problems I was addicted to when building the digdag environment with docker
Specify the favorite IP of the host network with docker-compose and start it
[Docker] How to build when the source code is bind-mounted on the container
I was stuck with the handling of the time zone when formatting with SimpleDateFormat
Generate source code from JAR file with JD-GUI of Java Decompiler project
If you have trouble with the character code problem in Myanmar (Burmese)
[swift5] How to change the color of TabBar or the color of item of TabBar with code
Source code for finding an orthonormal basis with the Gram-Schmidt orthogonalization method
The application absorbs the difference in character code
Check the operation using jetty with Maven.
Let's specify the version when using docker
Check the contents of params with pry
When deploying the source used twitter4j failed
Error when building infrastructure with aws app
Change the layout when rotating with onConfigurationChanged
[Java] Precautions when comparing character strings with character strings
About the treatment of BigDecimal (with reflection)
Format the contents of LocalDate with DateTimeFormatter
[Implementation] Eliminate the ominous smell of code
Ruby: Nokogiri automatically determines the character code of html read in binary mode
[Code] Forcibly breaks through the C problem "* 3 or / 2" of [AtCoder Problem-ABC100] with Java [Code]
[IntelliJ IDEA] How to format only local changes when saving the source code
Resource handler settings when delivering SPA with the static resource function of Spring Boot