在使用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>