'Maven Error While Processing POM: [FATAL] Non-parseable POM...PITarget with reserved xml name

Anybody has any idea on why this error comes up right after importing a Spring Boot project in Springsource Tool Suite:

[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-parseable POM C:\Users\...\.m2\repository\com\fasterxml\oss-parent\33\oss-parent-33.pom: processing instruction can not have PITarget with reserved xml name (position: END_TAG seen ...</profiles>\n\n</project>\n<?xml

I looked everywhere and the only similar issues I came across were:

  • this, however, the solution there was to create a new workspace to resolve it. It doesn't work for me.
  • this but this also doesn't work for me.

Any help will greatly appreciated.

Thank you!



Solution 1:[1]

Apparently it had nothing to do with my codebase or POM. After I deleted everything in my ".m2" directory and rebuilt the project it started working fine.

Solution 2:[2]

Check whether

<?xml version="1.0" encoding="UTF-8"?>

line repeats in your XML (i.e pom.xml or settings.xml etc)

Solution 3:[3]

Sometimes leading blank line in pom.xml causes Maven to fail with above mentioned error. After removing leading blank line it worked for me.

Solution 4:[4]

Please change you Parent in pom. I used following XML and resolved the issue

 <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.3</version>
        <relativePath/>
    </parent>

Solution 5:[5]

The file is BOM encoded. There are 2 hex characters before the first < and that is preventing the file from being recognized. If you use the 32 bit version of NPP you can download the Hex Editor plugin and view (and delete) those 2 characters and save the file. My situation is similar but the file is being rebuilt so I can't just do that.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gauzy
Solution 2
Solution 3 Ganesh Thorat
Solution 4 Kiran
Solution 5 Keith Smith