Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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,) 
like image 211
jublikon Avatar asked Jun 23 '16 09:06

jublikon


2 Answers

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 ?

like image 65
Mickael Avatar answered Sep 22 '22 23:09

Mickael


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>
like image 37
Hareesh Kumar Sjv Avatar answered Sep 22 '22 23:09

Hareesh Kumar Sjv