Define Eclipse project encoding as UTF-8 from Maven

I want the encoding of my project file to be set to UTF-8.

Following the maven FAQ answer , I set the property project.build.sourceEncodingto UTF-8. Unfortunately, it has no effect.

Then, looking at the m2eclipse JIRA , I tried a workaround, defining a compiler plugin sourceEncoding, but it did not work, since I try to do this in a separate parent pom module.

Then, what is the solution to ensure that my files are in UTF-8 from maven?

Thank.

+5
source share
3 answers

( ) / , , MacRoman.

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
        <version>2.9</version>
        <configuration>
          <additionalConfig>
            <file>
              <name>.settings/org.eclipse.core.resources.prefs</name>
              <content>
                <![CDATA[eclipse.preferences.version=1${line.separator}encoding/<project>=${project.build.sourceEncoding}${line.separator}]]>
              </content>
            </file>
          </additionalConfig>
        </configuration>
      </plugin>
    </plugins>
  </build>

:

mvn eclipse:eclipse

.

+17

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

.

- , 2011 . . eclipse 343927.

+2

Eclipse UTF-8 Maven

, MNGECLIPSE-1782, , m2eclipse . Eclipse ( > > ).

+1
source

All Articles