Saturday, February 28, 2009

Maven assembly locales

In the last few days, i was working on a project that involves taring files which include spanish characters. The problem i was facing is that the spanish characters don't get properly encoded on the unix environment when i use maven to do the build. The solution was to add the spanish locale to the plugin configuration that generates the tar:
<plugin>     
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-assembly-plugin</artifactId>
       <version>2.2-beta-2</version>
       <configuration>
            <locales>
               <locale>en</locale>
               <locale>es</locale>
            </locales>
            <descriptor>src/main/assembly/src.xml</descriptor>
            <inputEncoding>UTF-8</inputEncoding>
            <outputEncoding>UTF-8</outputEncoding>
       </configuration>
       <executions>
    <execution>
        <id>make-assembly</id>
        <phase>package</phase>
        <goals>
            <goal>assembly</goal>
        </goals>
    </execution>
       </executions>
</plugin>

No comments: