You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Robert Reiner <rr...@smartics.de> on 2006/12/01 09:31:02 UTC

Resources with different encoding

Hi!

I have a question concerning the maven-resources-plugin: In my resource
folder I have files with different encodings. The XML files are UTF-8, the
properties files are ISO-8859-1. Since I set the encoding for copying the
files to UTF-8, my property files are not copied properly.

A workaround I can think of is running the resources plugin a second time
and include only the property files with the encoding set to ISO-8859-1. But
how can I specify these files in the configuration of the second execution
block?

Maybe there is a more maven-like way to do this: Can someone give me advice
how to handle resource files with different encodings? 

Thanks for your answer.

  Robert
-- 
View this message in context: http://www.nabble.com/Resources-with-different-encoding-tf2736719s177.html#a7635144
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Resources with different encoding

Posted by Robert Reiner <rr...@smartics.de>.
Hi Franz!

Thank you for your reply. Your solution looks very cool! I tried what you
mentioned, but it seems I'm using a different version of maven (2.0.4). When
I examine the schema (http://maven.apache.org/POM/4.0.0) I use to validate
my POM, I get an error telling me that there is no element called
'encoding'.

Do I have to upgrade maven? May I use a different POM for validating? I
found no hint on the release plugin page either. May I ask for some more
advice about where to look for?

Thank you in advance!

Best regards,

  Robert



franz see wrote:
> 
> Good day to you, Robert,
> 
> You must declare your UTF-8 files as one resource and your ISO-8859-1
> files as another. For example,
> 
> <project>
>   ...
>   <build>
>     <resources>
>       <resource>
>         <directory>src/main/resources</directory>
>         <encoding>UTF-8</encoding>
>         <includes>
>           <include>**/*.xml</include>
>         </includes>
>       </resource>
>       <resource>
>         <directory>src/main/resources</directory>
>         <encoding>ISO-88591</encoding>
>         <includes>
>           <include>**/*.properties</include>
>         </includes>
>       </resource>
>       <resource>
>         <directory>src/main/resources</directory>
>         <excludes>
>           <exclude>**/*.xml</exclude>
>           <exclude>**/*.properties</exclude>
>         </excludes>
>       </resource>
>     </resources>
> </project>
> 
> For more information, kindly take a look at [1].
> 
> Cheers,
> Franz
> 
> [1] http://maven.apache.org/plugins/maven-resources-plugin/
> 
> Robert Reiner wrote:
>> 
>> Hi!
>> 
>> I have a question concerning the maven-resources-plugin: In my resource
>> folder I have files with different encodings. The XML files are UTF-8,
>> the properties files are ISO-8859-1. Since I set the encoding for copying
>> the files to UTF-8, my property files are not copied properly.
>> 
>> A workaround I can think of is running the resources plugin a second time
>> and include only the property files with the encoding set to ISO-8859-1.
>> But how can I specify these files in the configuration of the second
>> execution block?
>> 
>> Maybe there is a more maven-like way to do this: Can someone give me
>> advice how to handle resource files with different encodings? 
>> 
>> Thanks for your answer.
>> 
>>   Robert
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Resources-with-different-encoding-tf2736719s177.html#a7702872
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Resources with different encoding

Posted by franz see <fr...@gmail.com>.
Good day to you, Robert,

You must declare your UTF-8 files as one resource and your ISO-8859-1 files
as another. For example,

<project>
  ...
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <encoding>UTF-8</encoding>
        <includes>
          <include>**/*.xml</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <encoding>ISO-88591</encoding>
        <includes>
          <include>**/*.properties</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <excludes>
          <exclude>**/*.xml</exclude>
          <exclude>**/*.properties</exclude>
        </excludes>
      </resource>
    </resources>
</project>

For more information, kindly take a look at [1].

Cheers,
Franz

[1] http://maven.apache.org/plugins/maven-resources-plugin/

Robert Reiner wrote:
> 
> Hi!
> 
> I have a question concerning the maven-resources-plugin: In my resource
> folder I have files with different encodings. The XML files are UTF-8, the
> properties files are ISO-8859-1. Since I set the encoding for copying the
> files to UTF-8, my property files are not copied properly.
> 
> A workaround I can think of is running the resources plugin a second time
> and include only the property files with the encoding set to ISO-8859-1.
> But how can I specify these files in the configuration of the second
> execution block?
> 
> Maybe there is a more maven-like way to do this: Can someone give me
> advice how to handle resource files with different encodings? 
> 
> Thanks for your answer.
> 
>   Robert
> 

-- 
View this message in context: http://www.nabble.com/Resources-with-different-encoding-tf2736719s177.html#a7682184
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org