Let us put our learning of properties to practical use. You will have observed the following warning while building the simple project that we created in the Building a simple project with Maven recipe in Chapter 1, Getting Started.
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
Let us remove this warning if we really do not want the build to be platform dependent.
Let's specify the source encoding for platform-independent builds in our Maven project, by performing the following steps:
<properties> <project.build.sourceEncoding>UTF-8 </project.build.sourceEncoding> </properties>
mvn package
The project.build.sourceEncoding
property explicitly specifies the encoding of the source files. Maven plugins get information about the encoding from the value of this property and use it.
This value will be the same on any platform that the project is built on and, thus, the build becomes independent of the platform.
3.135.187.210