Error parsing lifecycle processing instructions

2019-04-18 23:03发布

问题:

Below is my pom.xml file. On the very first line, I am getting an error of

Error parsing lifecycle processing instructions.

I need help finding what caused the error.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>First</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

</project>

回答1:

This issue was driving me insane, I've finally managed to solve it by deleting the whole maven repository located in:

Windows: c:\Users\<username>\.m2\

After that I just updated the project (Alt+F5 in Eclipse). Issue gone!

Maybe a clash of different versions of Maven (I use several different versions of Eclipse + m2e plugins).



回答2:

There is some dependency got corrupted into .m2 folder.

  • You need to delete that dependency from .m2 folder.
  • If you are not able to find which one is corrupted then delete all the dependency which are declared into pom.xml file.


回答3:

It is due to an older version of m2e-wtp integration plugin. To resolve the issue, in Eclipse(Neon) you can go to Help --> Install New Software.. --> Enter http://download.eclipse.org/m2e-wtp/milestones/neon/1.3/ in the Work with box and press enter. Tick all the checkboxes, install the plugins and restart the IDE. It should work. Similarly, for other versions, you might refer the following link https://www.eclipse.org/m2e-wtp/ and try the latest/previous builds depending on your Eclipse version.



回答4:

Take a look at eclipse web http://marketplace.eclipse.org/content/maven-integration-eclipse-wtp

The m2eclipse-wtp project has moved to the Eclipse Foundation. The m2eclipse-wtp plugin is now deprecated in favor of the newer m2e-wtp

Automatic installation from the marketplace has been suspended. m2eclipse-wtp 0.15.3 can be manually installed from http://download.jboss.org/jbosstools/updates/m2eclipse-wtp/

You need to first uninstall all m2e-wtp plugins in Eclipse, then install them from jboss url



回答5:

No need to clean .m2 folder, I fixed this issue by adding corresponding maven to eclipse



回答6:

This same problem happened to me.

I'm using the new Eclipse Neon. Maybe it's an issue related to the Maven version included in this new release.

I have solved it by using Gradle instead of Maven.

Note: you can try to use Maven with the previous version of Eclipse.



回答7:

Try this, it might be helpful.

<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.demo</groupId>
<artifactId>test1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<parent>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-parent</artifactId>
     <version>1.2.4.RELEASE</version>
     <relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>

    <java-version>1.8</java-version>

</properties>
<dependencies>

   <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
   </dependency>


    <dependency>

        <groupId>javax.servlet</groupId>

        <artifactId>javax.servlet-api</artifactId>

        <version>3.0.1</version>

        <scope>provided</scope>

    </dependency>

    <dependency>

        <groupId>javax.servlet</groupId>

        <artifactId>jstl</artifactId>

        <version>1.2</version>

    </dependency>

    <dependency>

        <groupId>junit</groupId>

        <artifactId>junit</artifactId>

        <version>3.8.1</version>

        <scope>test</scope>

    </dependency>

</dependencies>
 <build>

    <finalName>HelloWorld</finalName>

    <pluginManagement>

        <plugins>

            <plugin>

                <groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-compiler-plugin</artifactId>

                <version>2.3.2</version>

                <configuration>

                    <source>${java-version}</source>

                    <target>${java-version}</target>

                </configuration>

            </plugin>

            <plugin>

                <groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-war-plugin</artifactId>

                <version>2.4</version>

                <configuration>

                    <warSourceDirectory>src/main/webapp</warSourceDirectory>

                    <warName>SpringWebExample</warName>

                    <failOnMissingWebXml>false</failOnMissingWebXml>

                     </configuration>

                   </plugin>

                  </plugins>

               </pluginManagement>

      </build>
     </project>


回答8:

In my case the same issue was due to different version of maven. One which I installed manualy and other one which came Embedded with STS. I resolved this issue using below steps: 1. Deleted .M2 folder (c:\Users\.m2)

  1. Downloaded exact version of maven which is embedded with STS and configured same in env. variables and path variable. STS Embedded maven- Image

  2. Updated projects (Right click on project -> Maven -> Update Project...)

It took some time in update step as all dependencies downloaded again in .M2 folder. Finally issue is resolved.



回答9:

Before I made modifications to the .xml I made a copy in the same folder. After making my mods I began having issues.

Moving the backup out of the .m2 folder resolved the issue for me.



标签: java xml pom.xml