How to make maven build platform independent?

LinuxMaven

Linux Problem Overview


When building using Maven on my mac, on mvn install i get

> [WARNING] Using platform encoding (MacRoman actually) to copy filtered > resources, i.e. build is platform dependent!

Is it possible to either build for a given platform (Linux) or otherwise make build platform independent?

Linux Solutions


Solution 1 - Linux

It happens when you have not provided following in your pom.xml

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

Absence of this means you are using platform specific encoding and that's why the warning.

Solution 2 - Linux

And if @Kal's answer doesn't work for you, perhaps you can learn from my last 30 minutes... below link adds an additional line to the above answer and solved my problem. My problem was related to the maven-resources-plugin 2.6, but the provider of the following solution had a different problem it solved... https://stackoverflow.com/a/3018152/2485075

Solution 3 - Linux

For specific needs:

<!-- https://maven.apache.org/plugins/maven-resources-plugin/index.html -->
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-resources-plugin</artifactId>
	<version>3.1.0</version>
	<configuration>
		<encoding>UTF-8</encoding>
	</configuration>
</plugin>

If the plugin is already configured one should merely add

<encoding>UTF-8</encoding>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJames RaitsevView Question on Stackoverflow
Solution 1 - LinuxKalpak GadreView Answer on Stackoverflow
Solution 2 - LinuxMikeView Answer on Stackoverflow
Solution 3 - LinuxHenrik Damkjaer VindView Answer on Stackoverflow