Dennis Lundberg created MWAR-450:
------------------------------------

             Summary: ISO8859-1 properties files get changed into UTF-8 when 
filtered
                 Key: MWAR-450
                 URL: https://issues.apache.org/jira/browse/MWAR-450
             Project: Maven WAR Plugin
          Issue Type: Improvement
          Components: filtering
    Affects Versions: 3.3.2
            Reporter: Dennis Lundberg


This issue is similar to https://issues.apache.org/jira/browse/MRESOURCES-171, 
but for filtering web resources in maven-war-plugin.

We add properties files that have ISO-8859-1 encoding, as per the Java 8 
requirements, as web resources in a war project. When these resources are 
filtered they get converted to the encoding specified by the 
project.build.sourceEncoding. There is a parameter resourceEncoding that can be 
used to change the encoding for web reources, but it applies to all web 
resource files which is not always what you want.

Here is the configuration used:
{code:xml}
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.3.2</version>
        <configuration>
          <webResources>
            <resource>
              <targetPath>WEB-INF/classes</targetPath>
              <filtering>true</filtering>
              <directory>src/main/webapp/WEB-INF/classes</directory>
            </resource>
          </webResources>
        </configuration>
      </plugin>
    </plugins>
  </build>
{code}

We propose to add a new parameter propertiesEncoding to the AbstractWarMojo. If 
the value of this parameter is set and filtering is enabled and a web resource 
file is a properties file, then the value of the parameter is used as encoding 
when filtering the file.

If the parameter is not specified it defaults to project.build.sourceEncoding, 
thus keeping the current behavior of the plugin unchanged.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to