jublikon
jublikon

Reputation: 3447

Maven: non-parseable POM

I have created a maven project and now I need to add dependencies to my dynamic web project. So I added the dependencies named in that spring tutorial.

Problem: I get the parsing issue:

Project build error: Non-parseable POM C:\Users\username\Development\Spring\Projects\MyWebService\pom.xml: Duplicated tag: 'build' (position: START_TAG seen ...\r\n \r\n \r\n ... @60:10)

My pom.xml looks like that:

<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>MyWebService</groupId>
    <artifactId>MyWebService</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.5.RELEASE</version>
    </parent>

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

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <warSourceDirectory>WebContent</warSourceDirectory>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-releases</id>
            <name>Spring Releases</name>
            <url>https://repo.spring.io/libs-release</url>
        </repository>
        <repository>
            <id>org.jboss.repository.releases</id>
            <name>JBoss Maven Release Repository</name>
            <url>https://repository.jboss.org/nexus/content/repositories/releases</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <name>Spring Releases</name>
            <url>https://repo.spring.io/libs-release</url>
        </pluginRepository>
    </pluginRepositories>


</project>

eclipse marks that line:

enter image description here

Question: Why is it wrong to have multiple repositories in the pom.xml?

Note: Maven Version

Name: EMPEDDED, Details: 3.3.9/1.7.0.20160603-1931 - for Name: WORKSPACE, Details: NOT AVAILABLE [3.0,) 

Upvotes: 6

Views: 35590

Answers (3)

Phil Freihofner
Phil Freihofner

Reputation: 7910

I had a similar problem, using Eclipse, arising after commenting out a dependency with <!-- and restoring it. Checked that the encoding is UTF-8. Restored the original POM. Updated/Rebuilt project. None of this helped.

What fixed the error: exiting and re-entering Eclipse.

Thank you, @user1516873, for your suggestion/comment on the question post.

Upvotes: 0

Hareesh Kumar Sjv
Hareesh Kumar Sjv

Reputation: 11

Try changing the latest version of spring boot like below:

<parent>  
    <groupId>org.springframework.boot</groupId>  
    <artifactId>spring-boot-starter-parent</artifactId>  
    <version>2.0.2.RELEASE</version>
</parent>

Upvotes: 1

Mickael
Mickael

Reputation: 4558

I'm seeing that in your error you have \r\n \r\n \r\n.

Could you please ensure that your pom.xml is correctly encoded in UTF-8 and not in ANSI ?

Upvotes: 7

Related Questions