为什么哈德森没有通过maven测试版本

时间:2011-09-20 09:15:37

标签: maven-2 hudson testng

我的项目中有一个TestNG测试。 当我从命令行使用mvn integration-test 运行它时,它说:

  

运行TestSuite   测试......   测试运行:1,失败:0,错误:0,跳过:0,经过的时间:0.29秒

     

结果:

     

测试运行:1,失败:0,错误:0,跳过:0

     

[INFO]

     

[INFO]建立成功[信息]

     

[INFO]总时间:1.468s [INFO]完成时间:9月20日星期二11:55:23 EEST

     

2011 [INFO]最终记忆:5M / 247M [INFO]

在Hudson中创建构建Maven 2/3项目(Legacy)类型的构建之后。 在目标中,我说集成测试。 最后我做立即构建然后我在Hudson控制台输出中看到的是:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building working 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default) @ working ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.9:test (default) @ working ---
[INFO] Surefire report directory: C:\Users\ybr\workspace\working\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
Testing  ...
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.29 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[HUDSON] Recording test results
projectSucceeded m.no:working:0.0.1-SNAPSHOT
projectFailed m.no:working:0.0.1-SNAPSHOT
sessionEnded
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.253s
[INFO] Finished at: Tue Sep 20 11:56:27 EEST 2011
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
mavenExecutionResult exceptions not empty
org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerException
    at org.apache.maven.lifecycle.internal.BuilderCommon.handleBuildError(BuilderCommon.java:128)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:95)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
    at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:146)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:124)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
    at hudson.remoting.UserRequest.perform(UserRequest.java:114)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:283)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
    at hudson.model.RunMap$2.compare(RunMap.java:188)

是否有人解决了这个问题并且可以写下它是如何解决的。 提前谢谢。

我的POM就是这样:

<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>

<groupId>comcom.no</groupId>
<artifactId>working</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<name>working</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>


<build>

    <testSourceDirectory>src\test\java\m.no.working</testSourceDirectory>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
                <execution>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <suiteXmlFiles>
                    <suiteXmlFile>src\test\java\testng.xml</suiteXmlFile>
                </suiteXmlFiles>
            </configuration>
        </plugin>
    </plugins>
</build>


<dependencies>



    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <version>2.5.0</version>
    </dependency>

    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.1.1</version>
        <scope>test</scope>
    </dependency>

</dependencies>

1 个答案:

答案 0 :(得分:0)

您使用的是多线程吗? Jenkins上存在一个修复问题导致多线程失败:

https://issues.jenkins-ci.org/browse/JENKINS-9183

另外,你使用Jenkins还是Hudson? 您考虑过迁移到Jenkins吗?

请参阅:

https://wiki.jenkins-ci.org/display/JENKINS/Upgrading+from+Hudson+to+Jenkins

这将解决Jenkins修复的许多问题。 也许你可以尝试为此做一个POC,然后建议将Hudson转移到Jenkins。