1

if I run my java maven project from Eclipse I don't habe problems. All encodings are UFT-8, but if I compile with

maven clean package

I have problems with the encoding on some different places. XSLT-transform, SOAP and so on.

I found some tricks in the Internet, but nothing helps. What can I do?

Things I tested with no effect:

pom.xml:

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

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
            <argLine>-Dfile.encoding=${project.build.sourceEncoding}</argLine>
        </configuration>
    </plugin>

On console:

mvn -DargLine=-Dfile.encoding=UTF-8 clean package

$ mvn --version
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T20:49:05+01:00)
Maven home: C:\Program Files\apache-maven-3.5.3
Java version: 1.8.0_201, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_201\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

The Platform encoding is CP1252. How can I say maven to use UTF-8, Eclipse can do it.

Thanks for any help.

UPDATE: I enabled the DEBUG output from Eclipse, there are this lines:

Maven home: C:\Users\EMBEDDED
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_201\jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

platform encoding: UTF-8 <- How can I do this

UPDATE 2: Setting Systemvariable JAVA_TOOL_OPTIONS to -Dfile.encoding=UTF-8 helps. Now it works.

Burner
  • 981
  • 19
  • 41
  • check this https://stackoverflow.com/questions/3017695/how-to-configure-encoding-in-maven – Jabir Jun 23 '20 at 09:23
  • 1
    I'm not sure Maven is the culprit here, as it's mostly used at compile/build time, while your issue seems to be at runtime? – sp00m Jun 23 '20 at 10:38
  • Yes, the platform encoding can be change in mvn.cmd. I do it, and compile. The problem is still there. – Burner Jun 23 '20 at 11:10

0 Answers0