2

I'd like to make Maven compile my project with the -Dfile.encoding=UTF8 flag, by setting it in the pom.xml, of the parent project.

This is not doing it:

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

So I get this error when Maven compiles:

    javac option: M:\Parent\persistence\target\generated-sources\apt
...\Database.java:90: error: unmappable character for encoding Cp1252
     * Semantics of SQL INSERT OR IGNOREÃ?
2
  • May we see the incriminated line in Database.java, just for completeness? Commented Jun 19, 2012 at 17:07
  • It looks the Database.java is a generated file and may be you missed to configure the correct at the plugin ? which generated the Database.java file... Commented Jun 19, 2012 at 17:08

1 Answer 1

2

According to the docs, what you have looks to be correct:

http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html

since that's failing, try setting it explicitly:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
Sign up to request clarification or add additional context in comments.

2 Comments

See the docs: Default value is: ${project.build.sourceEncoding}.
even doing so (and even <ecoding>UTF-8</encoding> did sovle the problem. I'm setting only the parent pom. Maybe if I change in the project pom it will work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.