IntelliJ IDE的新增功能,并尝试导入Eclipse项目源文件。它是基本的Spring Boot启动程序代码,但是需要构建。错误如下:
E:\JAVA_FULLSTACK\l2_source\c2_source\Bookstore>mvn
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-parseable POM
C:\Users\xxxx\.m2\repository\org\springframework\security\spring-
security-bom\4.1.4.RELEASE\spring-security-bom-4.1.4.RELEASE.pom: processing
instruction can not have PITarget with reserved xml name (position:
END_TAG seen ...</dependencyManagement>\n</project>\n<?xml ... @120:7) @
C:\Users\xxxx\.m2\repository\org\springframework\security\spring-
security-bom\4.1.4.RELEASE\spring-security-bom-4.1.4.RELEASE.pom, line 120,
column 7
@
这是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>
<groupId>com.bookstore</groupId>
<artifactId>bookstore</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Bookstore</name>
<description>frontend part for our bookstore project</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.3.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>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</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-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
我的Maven版本是:3.5.4,它不是ItelliJ的默认Maven。
浏览了StackOverflow并没有找到现有的解决方案,我真的希望就如何解决它提供一些建议!
也对spring-security-bom-4.1.4.RELEASE.pom
文件的功能感到好奇。为什么文件中有重复的XML属性设置?
更新: 删除.m2 \ repository并使用Maven插件重新同步项目以解决该问题。 2018年8月25日
答案 0 :(得分:0)
应该没有任何错误。首先,尝试通过删除文件夹C:\Users\xxxx\.m2\repository
重新同步您的Maven依赖项,然后转到IntelliJ->打开Maven插件(在右侧)->并同步项目。另外,我建议您从第一个屏幕快照中打开Enable Auto-Import
的Maven插件,并使用IntelliJ提供的默认Maven。