Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 位于xsi:schemaLocation的pom.xml中的Spring工具套件Maven项目错误_Java_Maven_Spring Boot - Fatal编程技术网

Java 位于xsi:schemaLocation的pom.xml中的Spring工具套件Maven项目错误

Java 位于xsi:schemaLocation的pom.xml中的Spring工具套件Maven项目错误,java,maven,spring-boot,Java,Maven,Spring Boot,我刚刚开始了我的第一个maven项目,但是在xsi:schemaLocation部分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.

我刚刚开始了我的第一个maven项目,但是在xsi:schemaLocation部分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>
我刚从spring入门指南中复制了它,但仍然出现了错误。不知道该怎么办。
我的mvn-v是3.5.2

尝试在pom.xml中包含此依赖项,并检查:

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

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

首先,正如@Duho所说,添加jackson依赖项有助于减少一些错误,现在错误计数减少到35。 然后错误出现在hibernate验证程序依赖项中,我通过添加hibernate验证程序依赖项修复了这个问题。 可以通过右键单击项目->Maven->添加依赖项来添加依赖项

然后我发现maven从中央存储库下载了一些不完整的文件到本地存储库,下载是不完整的。因此,我从Users/'myName'/.m2/repository文件夹中删除了扩展名为.lastUpdated的所有文件

然后,通过右键单击->Maven->更新项目来帮助解决所有错误


这对我很管用。。希望这对任何有同样问题的人都有效。

M2E版本和maven jar插件的3.1.2版本之间存在不兼容

在M2E或maven jar插件开发团队解决此问题之前,您必须在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>

包含上述依赖项仍然不走运:现在错误描述显示:未能从缓存在本地存储库中的存储库传输org.slf4j:slf4j api:jar:1.7.25,在经过central更新间隔或强制更新之前,不会重新尝试解析。您可能必须为maven配置本地存储库。请告诉我为什么。。我不太明白。pom.xml中提到的依赖项将首先在本地存储库中搜索。因此,应该正确配置它。在程序文件的某些地方,用户目录中应该有.m2文件夹。如果没有,请尝试创建一个。首先删除maven资源插件定义,因为spring boot已经正确定义了一个版本…除此之外,您在普通命令行上运行过吗?您能显示完整的日志输出吗?中间是否有代理/防火墙?
</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>