[
https://jira.codehaus.org/browse/MRESOURCES-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=328495#comment-328495
]
Emeric MARTINEAU commented on MRESOURCES-174:
---------------------------------------------
Hi,
I know is little bit tricky, but without any patch, you can do what you want.
To do this, you can use resoures:copy-resources goal.
Below an example :
{code:xml}
<build>
<resources>
<resource>
<directory>src/main/resources-not-avaible</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources1</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<encoding>UTF-8</encoding>
<resources>
<resource>
<directory>src/main/resources/UTF8</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-resources2</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<encoding>CP1252</encoding>
<resources>
<resource>
<directory>src/main/resources/cp1252</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<build>
{code}
In console output I have :
{code}
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @
generique-projet-js ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory \src\main\resources-not-avaible
[INFO]
[INFO] --- maven-resources-plugin:2.6:copy-resources (copy-resources1) @
generique-projet-js ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-resources-plugin:2.6:copy-resources (copy-resources2) @
generique-projet-js ---
[INFO] Using 'CP1252' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
{code}
In my target/classes I have two file with good encoding.
If it's ok for you close bug, otherwise, need to wait for a patch.
For auto-detect encoding, I think maven project must rewrite a detection class
from scratch (MPL/GPL license is-it compatible with Apache License ?).
> Loose encoding when filter resource
> -----------------------------------
>
> Key: MRESOURCES-174
> URL: https://jira.codehaus.org/browse/MRESOURCES-174
> Project: Maven 2.x Resources Plugin
> Issue Type: Bug
> Affects Versions: 2.6
> Environment: Maven 3.0.4
> Reporter: Lefebvre JF
>
> When filtering resource the build.source.encoding is taken enven if there are
> multiple encoding for properties, xml, ...
> Why do not use api to detect the original encoding ?
> http://code.google.com/p/juniversalchardet/
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira