2016-08-25 56 views
0

我正在使用Linux - Ubuntu 14.04。 我已經安裝了Jenkins 2.7.2。無法通過jenkins執行簡單的maven項目

我在Eclipse中創建了一個maven項目,並按照此鏈接提供的說明http://www.guru99.com/maven-jenkins-with-selenium-complete-tutorial.html

完成項目設置後,我將其作爲Maven Project執行並且構建成功。

然後,我安裝了Jenkins,安裝了Maven Integration Plugin,創建了一個Maven項目並添加了根POM位置,並且在'Goals and options'字段中,我給'test'作爲輸入並執行了Build,但Build是一個失敗。

控制檯輸出如下:

Started by user QA Admin 
Building in workspace /var/lib/jenkins/workspace/WebDriverTest2 
Parsing POMs 
Established TCP socket on 58065 
[WebdriverTest] $ java -Xms1024m -Xmx4096m -XX:PermSize=1024m -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-agent-1.7.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven/boot/plexus-classworlds-2.5.2.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven/conf/logging jenkins.maven3.agent.Maven32Main /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven /var/cache/jenkins/war/WEB-INF/lib/remoting-2.60.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-interceptor-1.7.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.7.jar 58065 
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=1024m; support was removed in 8.0 
<===[JENKINS REMOTING CAPACITY]===>channel started 
Executing Maven: -B -f /home/admin/workspace/WebdriverTest/pom.xml test 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building WebdriverTest 0.0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ WebdriverTest --- 
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] Copying 0 resource 
[INFO] 
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ WebdriverTest --- 
[INFO] Nothing to compile - all classes are up to date 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ WebdriverTest --- 
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] Copying 0 resource 
[INFO] 
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ WebdriverTest --- 
[INFO] Nothing to compile - all classes are up to date 
[INFO] 
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ WebdriverTest --- 

------------------------------------------------------- 
T E S T S 
------------------------------------------------------- 

Results : 

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

[JENKINS] Recording test results 
hudson.AbortException: Test reports were found but none of them are new. Did tests run? 
For example, /home/admin/workspace/WebdriverTest/target/surefire-reports/TEST-TestSuite.xml is 23 min old 

    at hudson.tasks.junit.TestResult.parse(TestResult.java:228) 
    at hudson.maven.reporters.SurefireArchiver.postExecute(SurefireArchiver.java:148) 
    at hudson.maven.Maven3Builder$MavenExecutionListener.recordMojoEnded(Maven3Builder.java:634) 
    at hudson.maven.Maven3Builder$MavenExecutionListener.mojoFailed(Maven3Builder.java:667) 
    at hudson.maven.Maven3Builder$JenkinsEventSpy.onEvent(Maven3Builder.java:311) 
    at org.apache.maven.eventspy.internal.EventSpyDispatcher.onEvent(EventSpyDispatcher.java:104) 
    at org.apache.maven.eventspy.internal.EventSpyExecutionListener.mojoFailed(EventSpyExecutionListener.java:138) 
    at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:90) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:219) 
    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.buildProject(LifecycleModuleBuilder.java:116) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) 
    at org.jvnet.hudson.maven3.launcher.Maven32Launcher.main(Maven32Launcher.java:132) 
    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:498) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238) 
    at jenkins.maven3.agent.Maven32Main.launch(Maven32Main.java:186) 
    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:498) 
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:136) 
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:71) 
    at hudson.remoting.UserRequest.perform(UserRequest.java:153) 
    at hudson.remoting.UserRequest.perform(UserRequest.java:50) 
    at hudson.remoting.Request$2.run(Request.java:332) 
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 5.097 s 
[INFO] Finished at: 2016-08-25T17:16:17+05:30 
[INFO] Final Memory: 18M/981M 
[INFO] ------------------------------------------------------------------------ 
Waiting for Jenkins to finish collecting data 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project WebdriverTest: Error creating properties files for forking: No such file or directory -> [Help 1] 
[JENKINS] Archiving /home/admin/workspace/WebdriverTest/pom.xml to WebdriverTest/WebdriverTest/0.0.1-SNAPSHOT/WebdriverTest-0.0.1-SNAPSHOT.pom 
[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. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException 
/home/admin/workspace/WebdriverTest/pom.xml is not inside /var/lib/jenkins/workspace/WebDriverTest2/home/admin/workspace/WebdriverTest/; will archive in a separate pass 
channel stopped 
Finished: FAILURE 

任何幫助不勝感激。請幫忙。提前致謝。

回答

0

它看起來像你可能已經給出了POM文件的絕對路徑。在頂部Maven的日誌

Building in workspace /var/lib/jenkins/workspace/WebDriverTest2

,並在結束時,你可以看到

/home/admin/workspace/WebdriverTest/pom.xml is not inside /var/lib/jenkins/workspace/WebDriverTest2/home/admin/workspace/WebdriverTest/; will archive in a separate pass

所以,如果我在想什麼是正確的,你只需要改變「根POM」參數。給它一個從項目根目錄到pom.xml的相對路徑。所以,如果你的項目是

WebDriverTest src/main/java src/test/java ... pom.xml

「根POM」參數應該只是pom.xml

+0

謝謝您的答覆。這是我的根POM路徑「/home/admin/workspace/WebdriverTest/pom.xml」。我已經在Jenkins配置中添加了這個。 –

+0

嘗試只保留WebdriverTest/pom.xml – Tim

+0

它正在尋找/ var/lib/jenkins/workspace/WebDriverTest2/home/admin/workspace/WebdriverTest /不存在的pom。我習慣在持續集成環境中運行Jenkins,所以對我來說可能會有所不同。嘗試將您的工作區更改爲/ home/admin/workspace/WebdriverTest/ – gregbert

相關問題