在使用maven打包时,出现以下错误:
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project flow-traffic-statistics: 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): Remote host closed connection during handshake
解决方法是在pom.xml中build节点添加以下内容
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>

本文介绍了在使用Maven进行项目打包时遇到的依赖解析错误,并提供了解决方案,即通过在pom.xml文件中配置maven-surefire-plugin插件跳过测试来规避问题。
1897

被折叠的 条评论
为什么被折叠?



