pom.xml中的弹簧工具套件Maven项目错误在XSI:示意图



我刚刚启动了我的第一个Maven项目,但是在XSI的pom.xml文件的第一行中出现了错误:示意图零件。

我的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>com.example.demo</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Demo Course API</name>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.0.RELEASE</version>
</parent>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>
<properties>
    <java.version>1.8</java.version>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.4.2</version>
        </plugin>
    </plugins>
</build>
</project>

错误描述的前几行是

Failure to transfer com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0 from https://repo.maven.apache.org/maven2 was cached in the 
 local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not 
 transfer artifact com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0 from/to central (https://repo.maven.apache.org/maven2): The operation was 
 cancelled. org.eclipse.aether.transfer.

我只是从春季入门指南中复制了它,但仍然有错误。不知道该怎么办。我的MVN -V是3.5.2

M2E版本与Maven-Jar-Plugin的3.1.2版本之间存在不相容性。

直到M2E或Maven-Jar-Plugins的开发团队解决该问题之前,您必须在pom.xml文件中添加以下行以解决此问题:

</project>
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.1</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

尝试在pom.xml中加入此依赖性并检查:

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.9.0.pr2</version>
</dependency>

分析错误描述有助于解决上述问题。错误计数为53。

首先,如@duho所述,添加杰克逊依赖关系有助于减少错误,现在错误计数减少到35。然后,错误是在Hibernate验证器的依赖性中,我通过添加Hibernate验证器依赖项来解决此问题。可以通过右键单击项目 -> maven->添加依赖项。

可以添加依赖关系。

然后,我发现Maven下载了一些未完成的文件从中央存储库到本地存储库,下载是不完整的。因此,我从用户/'myname'/。m2/储存文件夹中删除了所有文件。

然后,从右键单击 -> maven->更新项目通过更新该项目来解决所有错误。

它对我有用。.希望这对有同样问题的人有用。

最新更新