未能执行目标org.apache.maven.plugins:maven-surefire-plugin:2.10:test

我已经search了近五天的互联网寻找解决这个问题,但我似乎无法自行find并修复它,主要是因为我是如此新的Maven和PlayN,所以我不完全确定在我正在看什么。 但是,在build立核心的过程中显然正在摸索。 似乎无法下载“神器filter”,并且无法运行Surefire的testing。 但是,我只是在猜测我不完全理解的东西,尽pipe我一直在试图研究这些东西像疯了似的。 任何来自更有经验的人的帮助将非常,非常感激。 我正在失去我的想法。

[INFO] Building Synthesis Core 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ synthesis-core --- [INFO] [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ synthesis-core --- [debug] execute contextualize [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 2 resources [INFO] skip non existing resourceDirectory C:\Users\Josiah\synthesis\core\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:2.3:compile (default-compile) @ synthesis-core --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ synthesis-core --- [debug] execute contextualize [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Users\Josiah\synthesis\core\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:2.3:testCompile (default-testCompile) @ synthesis-core --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.10:test (default-test) @ synthesis-core --- Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-common-artifact-filters/1.3/maven-common-artifact-filters-1.3.pom [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Synthesis Metaproject ............................. SUCCESS [1.059s] [INFO] Synthesis Core .................................... FAILURE [3.538s] [INFO] Synthesis Java .................................... SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.997s [INFO] Finished at: Wed Oct 31 23:57:38 EDT 2012 [INFO] Final Memory: 6M/109M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project synthesis-core: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.10 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-surefire-plugin:jar:2.10 (): Failed to read artifact descriptor for org.apache.maven.shared:maven-common-artifact-filters:jar:1.3: Could not transfer artifact org.apache.maven.shared:maven-common-artifact-filters:pom:1.3 from/to central (http://repo.maven.apache.org/maven2): Remotely Closed [id: 0x0847a8f3, /192.168.1.54:65153 :> repo.maven.apache.org/93.184.215.223:80] -> [Help 1] 

然后我打印了整个debugging日志,并且在Surefire位上详细阐述了一下,显示了所有调用的exception:

 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2. 10:test (default-test) on project synthesis-core: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test failed: Plugin org.apa che.maven.plugins:maven-surefire-plugin:2.10 or one of its dependencies could no t be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven -surefire-plugin:jar:2.10 (): Failed to read artifact descriptor for org.apache. maven.shared:maven-common-artifact-filters:jar:1.3: Could not transfer artifact org.apache.maven.shared:maven-common-artifact-filters:pom:1.3 from/to central (h ttp://repo.maven.apache.org/maven2): Connection reset -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o rg.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on projec t synthesis-core: Execution default-test of goal org.apache.maven.plugins:maven- surefire-plugin:2.10:test failed: Plugin org.apache.maven.plugins:maven-surefire -plugin:2.10 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-surefire-plugin:jar:2.10 () at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:225) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje ct(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje ct(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu ild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl eStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun cher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav a:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La uncher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java: 352) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-t est of goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test failed: Plu gin org.apache.maven.plugins:maven-surefire-plugin:2.10 or one of its dependenci es could not be resolved: Failed to collect dependencies for org.apache.maven.pl ugins:maven-surefire-plugin:jar:2.10 () at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default BuildPluginManager.java:82) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:209) ... 19 more Caused by: org.apache.maven.plugin.PluginResolutionException: Plugin org.apache. maven.plugins:maven-surefire-plugin:2.10 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-sur efire-plugin:jar:2.10 () at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.re solve(DefaultPluginDependenciesResolver.java:211) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.createPlug inRealm(DefaultMavenPluginManager.java:353) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.setupPlugi nRealm(DefaultMavenPluginManager.java:321) at org.apache.maven.plugin.DefaultBuildPluginManager.getPluginRealm(Defa ultBuildPluginManager.java:175) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default BuildPluginManager.java:78) ... 20 more Caused by: org.sonatype.aether.collection.DependencyCollectionException: Failed to collect dependencies for org.apache.maven.plugins:maven-surefire-plugin:jar:2 .10 () at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectD ependencies(DefaultDependencyCollector.java:258) at org.sonatype.aether.impl.internal.DefaultRepositorySystem.collectDepe ndencies(DefaultRepositorySystem.java:308) at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.re solve(DefaultPluginDependenciesResolver.java:199) ... 24 more Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven.shared:maven-common-artifact-filt ers:jar:1.3 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader. loadPom(DefaultArtifactDescriptorReader.java:296) at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader. readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186) at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process( DefaultDependencyCollector.java:412) at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process( DefaultDependencyCollector.java:544) at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectD ependencies(DefaultDependencyCollector.java:240) ... 26 more Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.apache.maven.shared:maven-common-artifact-filters:pom:1.3 from/to central (http://repo.maven.apache.org/maven2): Connection reset at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(Def aultArtifactResolver.java:538) at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArti facts(DefaultArtifactResolver.java:216) at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArti fact(DefaultArtifactResolver.java:193) at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader. loadPom(DefaultArtifactDescriptorReader.java:281) ... 30 more Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not tra nsfer artifact org.apache.maven.shared:maven-common-artifact-filters:pom:1.3 fro m/to central (http://repo.maven.apache.org/maven2): Connection reset at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(W agonRepositoryConnector.java:951) at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(W agonRepositoryConnector.java:941) at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask. run(WagonRepositoryConnector.java:669) at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(Run nableErrorForwarder.java:60) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec utor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor .java:908) at java.lang.Thread.run(Thread.java:662) Caused by: org.apache.maven.wagon.TransferFailedException: Connection reset at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInput Data(AbstractHttpClientWagon.java:799) at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:11 6) at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88) at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61) at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask. run(WagonRepositoryConnector.java:601) ... 4 more Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:168) at org.apache.maven.wagon.providers.http.httpclient.impl.io.AbstractSess ionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:149) at org.apache.maven.wagon.providers.http.httpclient.impl.io.SocketInputB uffer.fillBuffer(SocketInputBuffer.java:110) at org.apache.maven.wagon.providers.http.httpclient.impl.io.AbstractSess ionInputBuffer.readLine(AbstractSessionInputBuffer.java:264) at org.apache.maven.wagon.providers.http.httpclient.impl.conn.DefaultRes ponseParser.parseHead(DefaultResponseParser.java:98) at org.apache.maven.wagon.providers.http.httpclient.impl.io.AbstractMess ageParser.parse(AbstractMessageParser.java:252) at org.apache.maven.wagon.providers.http.httpclient.impl.AbstractHttpCli entConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281) at org.apache.maven.wagon.providers.http.httpclient.impl.conn.DefaultCli entConnection.receiveResponseHeader(DefaultClientConnection.java:247) at org.apache.maven.wagon.providers.http.httpclient.impl.conn.AbstractCl ientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:219) at org.apache.maven.wagon.providers.http.httpclient.protocol.HttpRequest Executor.doReceiveResponse(HttpRequestExecutor.java:298) at org.apache.maven.wagon.providers.http.httpclient.protocol.HttpRequest Executor.execute(HttpRequestExecutor.java:125) at org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultR equestDirector.tryExecute(DefaultRequestDirector.java:645) at org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultR equestDirector.execute(DefaultRequestDirector.java:464) at org.apache.maven.wagon.providers.http.httpclient.impl.client.Abstract HttpClient.execute(AbstractHttpClient.java:820) at org.apache.maven.wagon.providers.http.httpclient.impl.client.Abstract HttpClient.execute(AbstractHttpClient.java:754) at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.execute(A bstractHttpClientWagon.java:674) at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInput Data(AbstractHttpClientWagon.java:793) ... 8 more 

编辑:添加在我的pom.xml进行分析。

 <?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 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.googlecode.playn</groupId> <artifactId>playn-project</artifactId> <version>1.3.1</version> </parent> <groupId>com.hijackedlongboat</groupId> <artifactId>synthesis</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging> <name>Synthesis Metaproject</name> <properties> <playn.version>1.3.1</playn.version> </properties> <profiles> <profile> <id>java</id> <activation><activeByDefault>true</activeByDefault></activation> <modules><module>java</module></modules> </profile> <profile> <id>android</id> <modules><module>android</module></modules> </profile> <profile> <id>ios</id> <modules><module>ios</module></modules> </profile> <profile> <id>html</id> <modules><module>html</module></modules> </profile> <profile> <id>flash</id> <modules><module>flash</module></modules> </profile> </profiles> <modules> <module>core</module> </modules> </project> 

编辑2:解决通过使用“mvn dependency :: tree”命令,我能够find一个缺less的存储库,没有显示在debugging和堆栈跟踪。 缺less的存储库是“forplay-legacy”,然后我将其添加到pom.xml中,如下所示:

  <repositories> <repository> <id>forplay-legacy</id> <url>http://forplay.googlecode.com/svn/mavenrepo</url> </repository> </repositories> 

http://repo.maven.apache.org/maven2):连接重置;…”

你确定你没有任何问题从你正在build立的主机访问互联网吗?如果是这样,find你所缺less的依赖关系(mvn dependency :: tree),然后手动安装它们,然后用-o (离线)选项。

我有类似的问题,我可以使用-U选项与mvn命令一起解决它

 mvn clean install -U 

这对我有用,希望它有帮助。

更新Maven项目:

脚步:

  1. 右键单击“项目”
  2. 转到“Maven”>>“更新”
  3. 等待所有更改应用
  4. 提交更改(如果代码在回购)

我有一个类似的问题,但所有的答案在这里没有帮助我。

对我来说,这个问题是一个失败的testing。 如果你正在开发一个testing驱动的stlye比一个失败/未执行的testing不应该打破构build。 我仍然希望我的项目build立。

为了解决这个问题,我添加了一个configuration,以确保它忽略了一个失败的testing。

 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> <testFailureIgnore>true</testFailureIgnore> </configuration> </plugin> 

如果某些unit testing用例失败,则会发生此错误。

jdk1.8.0_92更改为jdk1.7.0_80后,我的错误得到解决。

在我的应用程序中,某些unit testing与Java 8不兼容,所以它们失败了。 构build将成功与mvn clean install -DskipTests但不build议跳过unit testing。

当我遇到问题时, changes.xml文件格式不正确(缺less结束标签)。 解决方法是编辑XML以使其格式良好。

因此,检查XML格式是否正确是非常重要的,特别是当发布插件不会抱怨的时候。

对我来说,改变jenkins版本帮助。

  <parent> <groupId>org.jenkins-ci.plugins</groupId> <artifactId>plugin</artifactId> <version>1.642.4</version><!-- which version of Jenkins is this plugin built against? --> </parent> 

我面临同样的错误,但在我的情况下,删除/target文件夹和nbactions.xml文件后,问题已解决。

我仍然得到这个以下错误:

 [INFO] BUILD FAILURE [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire- plugin:2.12.4:test (default-test) on project MyMavenProject: Execution default-test of goal org.apache.maven.plugins:maven-surefire- plugin:2.12.4:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? 

这是我的POM.xml文件:

 <dependencies> <!-- POI --> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.6</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.6</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml-schemas</artifactId> <version>3.6</version> </dependency> <dependency> <groupId>dom4j</groupId> <artifactId>dom4j</artifactId> <version>1.1</version> </dependency> <dependency> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> <version>2.3.0</version> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.4.0</version> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-firefox-driver</artifactId> <version>3.4.0</version> </dependency> <dependency> <groupId>com.relevantcodes</groupId> <artifactId>extentreports</artifactId> <version>2.41.2</version> </dependency> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.11</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire</artifactId> <version>2.20</version> <type>pom</type> </dependency> <!-- Appium --> <dependency> <groupId>io.appium</groupId> <artifactId>java-client</artifactId> <version>3.3.0</version> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.2.4</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.3.3</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>17.0</version> </dependency> <dependency> <groupId>cglib</groupId> <artifactId>cglib</artifactId> <version>3.1</version> </dependency> <dependency> <groupId>commons-validator</groupId> <artifactId>commons-validator</artifactId> <version>1.4.1</version> </dependency> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.4</version> </dependency> </dependencies>