Java Maven:不可解析的 POM
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37986943/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maven: non-parseable POM
提问by jublikon
I have created a maven projectand now I need to add dependencies to my dynamic web project
.
So I added the dependencies named in that spring tutorial.
我已经创建了一个Maven 项目,现在我需要将依赖项添加到我的dynamic web project
. 所以我添加了那个spring 教程中命名的依赖项。
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)
项目构建错误:不可解析的 POM C:\Users\username\Development\Spring\Projects\MyWebService\pom.xml:重复标签:'build'(位置:START_TAG 看到 ...\r\n \r\n \ r\n ... @60:10)
My pom.xml looks like that:
我的 pom.xml 看起来像这样:
<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:
eclipse 标记那条线:
Question:Why is it wrong to have multiple repositories in the pom.xml?
问题:为什么在 pom.xml 中有多个存储库是错误的?
Note:Maven Version
注意:Maven 版本
Name: EMPEDDED, Details: 3.3.9/1.7.0.20160603-1931 - for Name: WORKSPACE, Details: NOT AVAILABLE [3.0,)
采纳答案by Mickael
I'm seeing that in your error you have \r\n \r\n \r\n
.
我在你的错误中看到你有\r\n \r\n \r\n
.
Could you please ensure that your pom.xml
is correctly encoded in UTF-8 and not in ANSI ?
你能确保你pom.xml
的编码是正确的 UTF-8 而不是 ANSI 吗?
回答by Hareesh Kumar Sjv
Try changing the latest version of spring bootlike below:
尝试更改最新版本的spring boot,如下所示:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
</parent>