Uploaded image for project: 'Maven WAR Plugin'
  1. Maven WAR Plugin
  2. MWAR-450

ISO8859-1 properties files get changed into UTF-8 when filtered

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.3.2
    • 3.4.0
    • filtering
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              dennisl Dennis Lundberg
              dennisl@apache.org Dennis Lundberg
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: