Skip to content

[MWAR-450] ISO8859-1 properties files get changed into UTF-8 when filtered #528

@jira-importer

Description

@jira-importer

Dennis Lundberg opened MWAR-450 and commented

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:

<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>

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.


Affects: 3.3.2

Remote Links:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions