我正在尝试向我的 Maven 项目添加依赖项,但无法让它工作。
这是我的 POM 文件:
<project xmlns="https://maven.apache.org/POM/4.0.0"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hva.dmci.ict.ads</groupId>
<artifactId>TrainsSolution</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.4.0-M1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
构建我的项目时出现此错误:
无法在项目 TrainsSolution 上执行目标:无法解析项目 hva.dmci.ict.ads 的依赖项:TrainsSolution:jar:1.0-SNAPSHOT:无法收集 [org.junit.jupiter:junit-jupiter:jar 的依赖项:5.4.0-M1 (测试)]: 无法读取 org.junit.jupiter:junit-jupiter:jar:5.4.0-M1: 无法传输 Artifact org.junit.jupiter:junit-jupiter:pom :5.4.0-M1 从/到中央 ( http://repo.maven.apache.org/maven2 ): 无法传输文件: http://repo.maven.apache.org/maven2/org/junit/jupiter/junit-jupiter/5.4.0-M1/junit-jupiter-5.4.0-M1.pom 。返回代码为: 501 ,ReasonPhrase:HTTPS 必需。 -> [帮助1]
有谁能帮帮我吗?
最佳答案
也许您应该更新 Maven 的版本。检查这个答案https://stackoverflow.com/a/59764670/3287786 .
关于java - 无法将 Junit 添加到我的 Maven 项目 (Netbeans),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60464997/