简体   繁体   中英

Why am I seeing this Springboot starter 2.1.2 pom non-parsable issue?

I have been battling with Spring for a couple of hours trying to get it to parse a pom file. Using spring's initilzr I created a projected with the required dependencies as can be seen in the pom below. I have checked it against a xml formatter and everything seems fine however it doesn't want to compile giving the error:

Non-parseable POM /Users/mel22/.m2/repository/org/springframework/boot/spring-boot-starter-parent/2.1.2.RELEASE/spring-boot-starter-parent-2.1.2.RELEASE.pom: Expected root element 'project' but found 'html'

I have tried mutliple things including deleting my .m2/repository, mvn clean install/package.

Here is my pom.xml:

<?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>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.2.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.ellismatt</groupId>
<artifactId>springrestapi</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>springrestapi</name>
<description>Spring REST Api project for Spring Boot</description>

<properties>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-mongodb</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-websocket</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.kafka</groupId>
        <artifactId>spring-kafka</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.kafka</groupId>
        <artifactId>spring-kafka-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

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

</project>

That one bit:

Expected root element 'project' but found 'html'

...reminds me of a really tricky issue I once saw. Are you in a corporate environment that uses Artifactory or Nexus or something similar for caching of resources? It's possible that there's a firewall issue resulting in your repository cache solution getting a "this website has been blocked" page and treating it as if it were the POM.

Try opening the relevant POM file from your .m2 directory in a text editor to see if it looks it might be HTML being returned from your firewall.

This exact thing happened to me once with Artifactory (but it was a JAR file for a dependency, and not a POM).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM