Maven WAR Plugin
  1. Maven WAR Plugin
  2. MWAR-164

Support for specifying which encoding to use when filtering resources

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1-alpha-1
    • Fix Version/s: 2.3
    • Component/s: filtering
    • Labels:
      None
    • Number of attachments :
      1

      Description

      Quoting Hervé:

      Maven filtering provides an encoding parameter to set encoding used when
      reading/writing files. But war plugin uses null value, which means platform
      encoding... Sorry, encoding support won't be totally "free"

      I added TODOs in the code.

      For web.xml and container config XML file, I set encoding to UTF-8, which is a
      better default value than platform encoding.

      For other filtered resources, you'll need to add an encoding attribute to
      o.a.m.model.Resource class, to let the user define which encoding he wants to
      use when filtering. Perhaps using project.build.sourceEncoding as a default
      value is a good idea.
      Seems like this is worth a Jira issue to track this new feature.

        Issue Links

          Activity

          Hide
          Florian Fray added a comment -

          Could somebody please review the patch and respond to this issue?

          Best regards,

          Florian

          Show
          Florian Fray added a comment - Could somebody please review the patch and respond to this issue? Best regards, Florian
          Hide
          Sebastian Davids added a comment - - edited

          Please review patch and/or fix differently, thanks.

          12 Votes and patch exists for almost a year now ...

          I am in favor of being consistent with the resources plugin: http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#encoding

          http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding

          Show
          Sebastian Davids added a comment - - edited Please review patch and/or fix differently, thanks. 12 Votes and patch exists for almost a year now ... I am in favor of being consistent with the resources plugin: http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#encoding http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding
          Hide
          Dennis Lundberg added a comment -

          I have committed a fix for this in http://svn.apache.org/viewvc?view=revision&revision=1388368 complete with an IT. The default encoding used is project.build.sourceEncoding, as suggested.

          I went the more difficult path and did not set the configured encoding for xml files. Intead for xml files (currently files ending in ".xml") the encoding is read from the files themselves. This means that you can have a mix of encodings in your resource files. The IT has a properties file encoded in ISO-8859-1 and an xml file encoded in UTF-8 which is also specified in the files xml header. Apart from the IT I've successfully tried this on several local projects that suffer from this bug.

          I have not yet deployed a new SNAPSHOT, but will do so later today. Please help test this.

          Also I want to add some documentation for this, apart from the parameter documentation that went in with this commit, before I close the issue.

          Show
          Dennis Lundberg added a comment - I have committed a fix for this in http://svn.apache.org/viewvc?view=revision&revision=1388368 complete with an IT. The default encoding used is project.build.sourceEncoding, as suggested. I went the more difficult path and did not set the configured encoding for xml files. Intead for xml files (currently files ending in ".xml") the encoding is read from the files themselves. This means that you can have a mix of encodings in your resource files. The IT has a properties file encoded in ISO-8859-1 and an xml file encoded in UTF-8 which is also specified in the files xml header. Apart from the IT I've successfully tried this on several local projects that suffer from this bug. I have not yet deployed a new SNAPSHOT, but will do so later today. Please help test this. Also I want to add some documentation for this, apart from the parameter documentation that went in with this commit, before I close the issue.
          Hide
          Dennis Lundberg added a comment -

          A new 2.3-SNAPSHOT has now been deployed.
          Please help us test this issue.

          Show
          Dennis Lundberg added a comment - A new 2.3-SNAPSHOT has now been deployed. Please help us test this issue.
          Hide
          Dennis Lundberg added a comment -

          Documentation added in r1391312.

          Show
          Dennis Lundberg added a comment - Documentation added in r1391312 .

            People

            • Assignee:
              Dennis Lundberg
              Reporter:
              kai lilleby
            • Votes:
              12 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: