Loading...

Thursday, April 2, 2009

Change character encoding scheme for Maven resource and compile plugin in NetBeans

In a previous post we have learned how to change the source version for the Maven compiler plugin. But we can also change the character encoding scheme from the same Project Properties dialog window. The Encoding select box let's us change the encoding for the Maven project.

NetBeans add an encoding element to the compiler plugin definition and adds a configuration for the resource plugin in the pom.xml.

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.0.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
    </plugins>
</build>