简体   繁体   English

Java Maven Spring Could not transfer artifact org.apache.maven.surefire:surefire-junit-platform:pom:2.22.2 from/to central

[英]Java Maven Spring Could not transfer artifact org.apache.maven.surefire:surefire-junit-platform:pom:2.22.2 from/to central

Java Spring project fails to package the project with maven, printing the following error: Java Spring 项目无法 package 项目出现 Z402C5D9AF6B43711EA070BEE5D7 打印错误:

Could not transfer artifact org.apache.maven.surefire:surefire-junit-platform:pom:2.22.2 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.pom

The use used pom: pom的使用:

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>***</groupId>
    <artifactId>***</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>***</name>
    <description>***</description>
    <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>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

I use IntelliJ to develop and build the project.我使用 IntelliJ 开发和构建项目。 I do not need a proxy to enter the internet.我不需要代理即可进入互联网。 If I click the link, I can see the pom file without problems.如果我点击链接,我可以毫无问题地看到 pom 文件。 Reloading the project does not work, downloading all sources neither.重新加载项目不起作用,也不能下载所有源。

In the local storage, I find the following files:在本地存储中,我找到以下文件:

C:\Users\***\.m2\repository\org\apache\maven\plugins\maven-surefire-plugin\2.22.2
    _remote.repositories
    maven-surefire-plugin-2.22.2.jar
    maven-surefire-plugin-2.22.2.jar.sha1
    maven-surefire-plugin-2.22.2.pom
    maven-surefire-plugin-2.22.2.pom.sha1

Removing them and reloading the project restores the files, the error persists.删除它们并重新加载项目会恢复文件,错误仍然存在。

I cleaned the project and used the -Dhttps.protocols=TLSv1.2 parameter no changes.我清理了项目并使用-Dhttps.protocols=TLSv1.2参数没有变化。

Edit:编辑:

Using a VPN doe not work.使用 VPN 不起作用。

Output of mvn -v : mvn -v的 Output :

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: C:\Program Files\java\apache-maven-3.8.4
Java version: 1.8.0_312, vendor: Temurin, runtime: C:\Program Files\Eclipse Adoptium\jdk-8.0.312.7-hotspot\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

When building with mvn clean package -U :使用mvn clean package -U构建时:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project Grafnus-Server: Unable to generate classpath: org.apache.maven.artifact.resolver.ArtifactResolutionException: Unable to get dependency information for org.apache.maven.surefire:surefire-junit-platform:jar:2.22.2: Failed to retrieve POM for org.apache.maven.surefire:surefire-junit-platform:jar:2.22.2: Could not transfer artifact org.apache.maven.surefire:surefire-junit-platform:pom:2.22.2 from/to central (https://repo.maven.apache.org/maven2): transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit-platform/2.22.2/surefire-junit-platform-2.22.2.pom

[ERROR] from the specified remote repositories:
[ERROR]   central (https://repo.maven.apache.org/maven2, releases=true, snapshots=false)
[ERROR] Path to dependency:
[ERROR]         1) dummy:dummy:jar:1.0

The issue was the outdated java version.问题是过时的 java 版本。 I updated to a newer one and at first I did not change it in the project settings (thought that would change on his own).我更新了一个更新的,起初我没有在项目设置中更改它(以为他会自己改变)。 Now it works like a charm.现在它就像一个魅力。 Thanks to @khmarbaise感谢@khmarbaise

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法将工件 org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 从/到中央 (http://repo1.Z402C5D9AF6B270711EAZD70BEE574) - Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from/to central (http://repo1.maven.org/maven2) 无法从 https://repo.maven.apache.org/maven2 传输 org.apache.maven.plugins:maven-surefire-plugin:pom:2.22.2 - Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.22.2 from https://repo.maven.apache.org/maven2 Maven 错误无法传输工件 org.apache.maven.plugins:maven-source-plugin:pom:3.0。 - Maven Errror Could not transfer artifact org.apache.maven.plugins:maven-source-plugin:pom:3.0.1 from/to central eclipse (pom.xml) 中的 Maven 错误:无法传输 org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 - Maven error in eclipse (pom.xml) : Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 尝试部署到 AZURE 时出错 无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test - Error when trying to deploy to AZURE Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test Maven Surefire中的类加载和派生异常(org.apache.maven.surefire.testset.TestSetFailedException:java.lang.NullPointerException) - Classloading and Forking exception in Maven Surefire (org.apache.maven.surefire.testset.TestSetFailedException: java.lang.NullPointerException) 适用于Java 9模块的带有junit-platform-surefire-provider的Maven-surefire-plugin - Maven-surefire-plugin with junit-platform-surefire-provider for Java 9 module Maven 为surefire-plugin 2.22.2构建 - Maven build for surefire-plugin 2.22.2 Maven surefire 插件 2.22.2 构建失败,用于 Junit 5 测试用例,错误不支持 Spring Boot 中的类文件主要版本 56 - Maven surefire plugin 2.22.2 build fails for Junit 5 test cases with errror Unsupported class file major version 56 in spring boot 如何在Maven中使用JUnit 5和Java 10以及配置maven-surefire-plugin和org.ow2.asm - How to use JUnit 5 and Java 10 in Maven with the confilcting maven-surefire-plugin and org.ow2.asm
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM