1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Mavenでのビルド時にソースの文字コードを指定する

Posted at

概要

Mavenでのビルド時にソースの文字コードを指定する方法を書く。Mavenでビルドする際にソースの文字コードを指定していない場合は以下のようなWarningが出る。

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

方法

pom.xmlに以下を追加する(UTF-8を指定する場合)。

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

階層は以下のようにする。

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

参考

Maven – Frequently Asked Technical Questions

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?