Maven Compiler Plugin
  1. Maven Compiler Plugin
  2. MCOMPILER-63

Provide specific default value for "encoding" parameter

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.0.2
    • Fix Version/s: None
    • Labels:
      None
    • Patch Submitted:
      Yes
    • Number of attachments :
      1

      Description

      As stated in the javac doc, the parameter "encoding" defaults to the platform's default encoding if not specified. This might be a convenient feature when running javac directly from the console prompt (less typing) but I consider this harmful for an automated build. The platform's default encoding might easily differ between machines/developers, causing unreliable build output.

      Maven has "reproducible builds" on its banner and as such, locking down all plugin versions has recently become a best practice. Likewise, the encoding used to process source files should be locked down. As Maven furthermore prefers convention over configuration, such a lockdown should be provided out-of-the-box.

      The attached patch adds a default value for the encoding that locks the encoding down to "ISO-8859-1" if not explicitly overriden by the user in the POM. I chose Latin-1 for consistency with the behavior of the Maven Site Plugin although I personally would have preferred UTF-8.

      Releasing the patch might break existing builds where users have relied on their platform's default encoding for handling Non-ASCII sources. The group of those people is hopefully small and their build can be easily fixed by updating the POM.
      Not emulatable would be the possibility to explicitly use the platform's default encoding as now but I do not think that there is really somebody out there playing russian roulette with the build output... Besides, now one requested such a risky thing for the Maven Site Plugin.

        Issue Links

          Activity

          Hide
          Vincent Siveton added a comment -

          Applied in r612342 Thanks!
          For the record, I liked your Maven philosophy point about the "reproducible builds".

          Show
          Vincent Siveton added a comment - Applied in r612342 Thanks! For the record, I liked your Maven philosophy point about the "reproducible builds".
          Hide
          Benjamin Bentmann added a comment -

          Default needs to be reverted to platform encoding according to user poll.

          Show
          Benjamin Bentmann added a comment - Default needs to be reverted to platform encoding according to user poll .
          Hide
          Benjamin Bentmann added a comment -

          Reverted in r653054.

          Show
          Benjamin Bentmann added a comment - Reverted in r653054 .

            People

            • Assignee:
              Benjamin Bentmann
              Reporter:
              Benjamin Bentmann
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: