Maven 3 Jenkins插件-Hello World示例的“构建失败”

jzhang22

我第一次使用Jenkins / Maven,并且一起遵循这两个教程来编写Jenkins插件:https ://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorialhttp://cleantestcode.wordpress .com / 2013/11/03 / how-to-to-write-a-jenkins-plugin-part-1 /

到目前为止,这些是我在Windows提示符下输入的命令/数据:

  1. mvn hpi:create -Pjenkins
  2. 输入“ org.jenkins-ci.tools”作为groupId
  3. 输入“ hello_world”作为artifactId
  4. cd hello_world
  5. mvn安装

使用以下输出,步骤5的结果为“ BUILD FAILURE”:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.9:test           (default-test) on project hello_world: There are test failures. [ERROR] 
[ERROR] Please refer to C:\$HOME\hello_world\target\surefire-reports for the individual test results. [ERROR] -> [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.

我尝试使用“ mvn install -DskipTests”代替,但是这种方式(我不确定如何表达它)命令提示符再也不会出现,并且我无法再输入任何命令。

我的问题是:

  1. 我尚未修改“ mvn hpi:create -Pjenkins”生成的任何文件,那么什么会导致默认测试失败?
  2. 如果没有“ -Pjenkins”标志,则命令“ mvn hpi:create”也会导致构建失败。添加“ -Pjenkins”标志有什么作用?

在此先感谢您提供任何答案。

[编辑]这是Surefire报告的内容:

    -------------------------------------------------------------------------------
Test set: InjectedTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 14.697 sec <<< FAILURE!
org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyTestSuite(org.jvnet.hudson.test.junit.FailedTest)  Time elapsed: 0.012 sec  <<< ERROR!
java.lang.ArrayIndexOutOfBoundsException: -1
    at com.thoughtworks.xstream.core.util.OrderRetainingMap.entrySet(OrderRetainingMap.java:77)
    at java.util.HashMap.putMapEntries(HashMap.java:511)
    at java.util.HashMap.putAll(HashMap.java:784)
    at com.thoughtworks.xstream.core.util.OrderRetainingMap.<init>(OrderRetainingMap.java:36)
    at com.thoughtworks.xstream.converters.reflection.FieldDictionary.buildMap(FieldDictionary.java:135)
    at com.thoughtworks.xstream.converters.reflection.FieldDictionary.fieldsFor(FieldDictionary.java:76)
    at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:127)
    at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:149)
    at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:108)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:898)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:887)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:860)
    at hudson.XmlFile.write(XmlFile.java:179)
    at jenkins.model.Jenkins.save(Jenkins.java:2656)
    at jenkins.model.Jenkins.setNoUsageStatistics(Jenkins.java:988)
    at org.jvnet.hudson.test.HudsonTestCase.setUp(HudsonTestCase.java:320)
    at org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyTestSuite.setUp(JellyTestSuiteBuilder.java:133)
    at org.jvnet.hudson.test.junit.GroupedTest.run(GroupedTest.java:49)
    at junit.framework.TestSuite.runTest(TestSuite.java:255)
    at junit.framework.TestSuite.run(TestSuite.java:250)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
    at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
    at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:172)
    at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:104)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:70)
testCliSanity(org.jvnet.hudson.test.PluginAutomaticTestBuilder$CliSanityTest)  Time elapsed: 0.027 sec  <<< ERROR!
java.lang.IllegalStateException: second instance
    at jenkins.model.Jenkins.<init>(Jenkins.java:758)
    at hudson.model.Hudson.<init>(Hudson.java:81)
    at org.jvnet.hudson.test.HudsonTestCase.newHudson(HudsonTestCase.java:469)
    at org.jvnet.hudson.test.HudsonTestCase.setUp(HudsonTestCase.java:312)
    at junit.framework.TestCase.runBare(TestCase.java:139)
    at org.jvnet.hudson.test.HudsonTestCase.runBare(HudsonTestCase.java:290)
    at junit.framework.TestResult$1.protect(TestResult.java:122)
    at junit.framework.TestResult.runProtected(TestResult.java:142)
    at junit.framework.TestResult.run(TestResult.java:125)
    at junit.framework.TestCase.run(TestCase.java:129)
    at junit.framework.TestSuite.runTest(TestSuite.java:255)
    at junit.framework.TestSuite.run(TestSuite.java:250)
    at junit.framework.TestSuite.runTest(TestSuite.java:255)
    at junit.framework.TestSuite.run(TestSuite.java:250)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
    at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
    at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:172)
    at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:104)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:70)
超超

尝试跳过测试,将第5条命令更改为:5. mvn install -DskipTests

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Jenkins Maven插件更改清单

来自分类Dev

Maven 3 Jenkins插件-Hello World示例的“构建失败”

来自分类Dev

业力-Maven插件失败

来自分类Dev

使用Lambda时,Maven插件构建失败

来自分类Dev

当Maven单元测试失败时,如何使Jenkins构建失败?

来自分类Dev

无法创建新的Maven Hello World项目

来自分类Dev

Spring Security 4.0 chat-jc示例的Maven构建失败

来自分类Dev

护照“ Hello World”总是失败

来自分类Dev

由于codehaus repo迁移,Jenkins / Maven构建失败

来自分类Dev

Maven Surefire插件+并行构建

来自分类Dev

Maven前端插件构建错误

来自分类Dev

示例Hello world flutter应用程序构建失败:任务':app:mergeDebugResources'的执行失败

来自分类Dev

QWebSocket Hello World示例

来自分类Dev

如何使用自定义Maven插件防止构建失败?

来自分类Dev

Jenkins Artifactory插件与Maven

来自分类Dev

Jenkins:当在Docker容器中进行Maven构建时,如何使用JUnit插件

来自分类Dev

Maven Surefire插件+并行构建

来自分类Dev

与将sonar:sonar添加到Maven构建步骤相比,Jenkins SonarQube插件的优势是什么?

来自分类Dev

如何打包Killbill hello-world插件

来自分类Dev

Jenkins Workflow插件如何使构建失败

来自分类Dev

Jenkins Artifactory插件忽略了Maven UniqueVersion

来自分类Dev

Maven前端插件构建错误

来自分类Dev

Hello World Minitest CLI示例

来自分类Dev

Jenkins 插件构建的配置

来自分类Dev

Jenkins / Maven 发布插件 SVN - 凭证

来自分类Dev

由于 Maven,简单的 Jenkins 管道构建失败

来自分类Dev

jenkins maven 元数据插件,使用参数构建不起作用

来自分类Dev

Eclipse Maven 构建/插件问题

来自分类Dev

在 Jenkins Pipeline 中扫描 gradle Hello world 项目

Related 相关文章

热门标签

归档