Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven: How to configure native2ascii-maven-plugin

Tags:

java

maven

Im firing this question at you guys since the project-page itself has not a lot of information. Basicly im setting up the native2ascii-maven-plugin to process some of my resources. It works fine for processing the files in root directory. But now i have files under subdirectory: /template/email/ and would like them to be included in the processing. Can you guys please help me out?

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>native2ascii-maven-plugin</artifactId>
        <version>1.0-alpha-1</version>
        <configuration>
            <dest>target/resources</dest>
            <src>src/main/resources</src>
        </configuration>
        <executions>
            <execution>
                <id>native2ascii-utf8</id>
                <goals>
                    <goal>native2ascii</goal>
                </goals>
                <configuration>
                    <encoding>UTF8</encoding>
                    <includes>ApplicationResources*.properties, errors.properties, /template/email/newBooking*.ftl</includes>
                </configuration>
            </execution>
        </executions>
    </plugin>

Thanks a bunch!!

like image 689
user829237 Avatar asked Aug 18 '11 09:08

user829237


2 Answers

You need to define a execution section for every folder you want to process and move the src and dest to the execution part:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>native2ascii-maven-plugin</artifactId>
    <version>1.0-alpha-1</version>
    <executions>
        <execution>
            <id>native2ascii-utf8-resources</id>
            <goals>
                <goal>native2ascii</goal>
            </goals>
            <configuration>
                <dest>target/resources</dest>
                <src>src/main/resources</src>
                <encoding>UTF8</encoding>
                <includes>ApplicationResources*.properties, errors.properties, /template/email/newBooking*.ftl</includes>
            </configuration>
        </execution>
        <execution>
            <id>native2ascii-utf8-email</id>
            <goals>
                <goal>native2ascii</goal>
            </goals>
            <configuration>
                <dest>target/resources/email</dest>
                <src>src/main/templates/email</src>
                <encoding>UTF8</encoding>
            </configuration>
        </execution>
    </executions>
</plugin>
like image 127
Tobias Schulte Avatar answered Sep 28 '22 00:09

Tobias Schulte


Here a solution for "native2ascii". All files (recursively) found in src/main/locale are destined to target/classes:

<project>
    [...]
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>native2ascii-maven-plugin</artifactId>
                <version>1.0-alpha-1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>native2ascii</goal>
                        </goals>
                        <configuration>
                            <encoding>UTF8</encoding>
                            <src>src/main/locale</src>
                            <dest>target/classes</dest>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            [...]
like image 39
Fred Avatar answered Sep 28 '22 02:09

Fred