Maven Eclipse Plugin
  1. Maven Eclipse Plugin
  2. MECLIPSE-56

Generated .project-file misses encoding declaration

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.5
    • Labels:
      None

      Description

      Hi,

      I'm experiencing problems creating eclipse project files, if the project's description in pom.xml contains special characters like german umlauts (like "öüä"). Refreshing the eclipse workspace after running eclipse:eclipse results in the following message from eclipse:

      "Errors occurred while refreshing resources with the local file system.
      Failed to read the project description file (.project) for comworld-eventlisteners. The file has been changed on disk, and it now contains invalid information. The project will not function properly until the description file is restored to a valid state."

      This is caused by the content of the .project's generated comment-tag containing the exact same description as in pom.xml. But the .project-file is generated without stating an encoding parser should use to read it. So, if I prepend the line
      <?xml version="1.0" encoding="ISO-8859-15"?>
      eclipse is able to read the file just fine.

      Regards,
      Stefan

        Issue Links

          Activity

          Hide
          Stefan Hübner added a comment -

          I'll attach a zip-file containing two test-projects who's POM's contain special characters. Corresponding testcases follow.

          Show
          Stefan Hübner added a comment - I'll attach a zip-file containing two test-projects who's POM's contain special characters. Corresponding testcases follow.
          Hide
          Stefan Hübner added a comment -

          This patch adds two new test cases to src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java

          Show
          Stefan Hübner added a comment - This patch adds two new test cases to src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
          Hide
          Stefan Hübner added a comment -

          Sorry, attached MECLIPSE-56-maven-eclipse-plugin.patch1 was meant here

          Show
          Stefan Hübner added a comment - Sorry, attached MECLIPSE-56 -maven-eclipse-plugin.patch1 was meant here
          Hide
          Stefan Hübner added a comment -

          I would suggest that the eclipse plugin always encodes generated .project-files to UTF-8. Furthermore those .project-files should contain a xml-prolog declaring the used encoding (i.e. UTF-8).

          Show
          Stefan Hübner added a comment - I would suggest that the eclipse plugin always encodes generated .project -files to UTF-8. Furthermore those .project -files should contain a xml-prolog declaring the used encoding (i.e. UTF-8).
          Hide
          Stefan Hübner added a comment -

          Attached MECLIPSE-56-maven-eclipse-plugin.patch2 was supposed to solve the problem, but failing test case testProject12 brings up another encoding related problem here. It seems, that the corresponding pom.xml isn't read using the encoding declared in its xml-prolog.

          Is this issue related to MNG-1603, somehow?

          Show
          Stefan Hübner added a comment - Attached MECLIPSE-56 -maven-eclipse-plugin.patch2 was supposed to solve the problem, but failing test case testProject12 brings up another encoding related problem here. It seems, that the corresponding pom.xml isn't read using the encoding declared in its xml-prolog. Is this issue related to MNG-1603 , somehow?
          Hide
          fabrizio giustina added a comment -

          this issue depends upon MNG-2025
          The fix which will set UTF-8 encoding in output files by default has been committed, but I can confirm that some model fields (like description) are not read using the correct encoding by Maven

          Show
          fabrizio giustina added a comment - this issue depends upon MNG-2025 The fix which will set UTF-8 encoding in output files by default has been committed, but I can confirm that some model fields (like description) are not read using the correct encoding by Maven
          Hide
          Stefan Hübner added a comment -

          This issue depends upon PLX-214 through MNG-2025.

          Show
          Stefan Hübner added a comment - This issue depends upon PLX-214 through MNG-2025 .
          Hide
          Kenney Westerhof added a comment -

          There's no need to specify an encoding in the <?xml processing instruction, since UTF-8 is the default encoding.

          Also java strings are printed as utf-8 by default, so there's probably only an issue in reading them from the pom.

          Show
          Kenney Westerhof added a comment - There's no need to specify an encoding in the <?xml processing instruction, since UTF-8 is the default encoding. Also java strings are printed as utf-8 by default, so there's probably only an issue in reading them from the pom.
          Hide
          Hervé Boutemy added a comment -
          • POM reading fixed in Maven 2.0.8 (before, the POM was read using platform encoding, not the encoding specified in the XML file)
          • Eclipse generated XML files fixed in r587580: written in UTF-8
          • testcase added in r609198

          for more info on XML encoding support, see http://docs.codehaus.org/display/MAVENUSER/XML+encoding

          Show
          Hervé Boutemy added a comment - POM reading fixed in Maven 2.0.8 (before, the POM was read using platform encoding, not the encoding specified in the XML file) Eclipse generated XML files fixed in r587580: written in UTF-8 testcase added in r609198 for more info on XML encoding support, see http://docs.codehaus.org/display/MAVENUSER/XML+encoding
          Hide
          Stefan Hübner added a comment -

          Thanks for fixing this issue!

          Show
          Stefan Hübner added a comment - Thanks for fixing this issue!

            People

            • Assignee:
              Hervé Boutemy
              Reporter:
              Stefan Hübner
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development