java - maven-surefire-plugin:2.18.1:测试失败
问题描述
我正在学习“Java 中的云原生应用程序”,并且正在做本书中的练习。这是我的 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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.3.RELEASE</version>
</parent>
<groupId>com.mycompany.petstore</groupId>
<artifactId>product</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
我在特定路径上设置了 Maven 的设置:C:\Users\Sam.m2\settings.xml
我在 settings.xml 上设置的唯一信息如下:
...
<proxies>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>localhost:8080</host>
<nonProxyHosts>localhost,127.0.0.1</nonProxyHosts>
<port>8080</port>
</proxy>
</proxies>
当我尝试运行这个程序(一个包含三个 java 类的简单程序)时,在我的控制台中有:
--- maven-surefire-plugin:2.18.1:test (default-test) @ product ---
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.18.1/maven-surefire-common-2.18.1.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-api/2.18.1/surefire-api-2.18.1.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven-toolchain/2.2.1/maven-toolchain-2.2.1.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-annotations/3.3/maven-plugin-annotations-3.3.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.873 s
[INFO] Finished at: 2019-07-21T15:32:13+02:00
[INFO] Final Memory: 18M/224M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project product: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.18.1 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-surefire-plugin:jar:2.18.1 -> org.apache.maven.surefire:maven-surefire-common:jar:2.18.1: Failed to read artifact descriptor for org.apache.maven.surefire:maven-surefire-common:jar:2.18.1: Could not transfer artifact org.apache.maven.surefire:maven-surefire-common:pom:2.18.1 from/to central (https://repo.maven.apache.org/maven2): localhost:8080 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
我该如何解决这个问题?
解决方案
推荐阅读
- java - 如何使用 JAVA 从 Azure 的 Cosmos DB 集合中获取所有文档?
- erlang - 如何在 shell 中使用 rebar3 创建 Erlang 应用程序?
- ios - c文件可以读取Xcode中的本地化字符串吗?
- java - 如何根据系统环境属性更改枚举值
- windows - 在 Windows 机器上构建 docker 映像时出现 chmod CommandNotFoundException
- c - CC1352P 启动板 SPI 接口不适用于我的应用
- php - 如何使用按日期范围的动态 mysql 查询从数据库中获取数据
- c# - 如何诊断 .net core ANCM 进程内启动失败
- browser - 如何更改 JMeter 执行目标浏览器?
- php - 如何在日期选择器中设置动态选定月份的第一个日期?