简体   繁体   English

在Jenkins中使用Maven解析POM文件时出错

[英]Error parsing POM File using Maven in Jenkins

So I've been trying to run my Selenium tests using Jenkins. 因此,我一直在尝试使用Jenkins运行Selenium测试。 I created a Maven project, and set the correct POM.xlm pathfile (At least it's what I'm almost certain) And I continue to get an error at parsing the POM file saying the file is not present in the file path. 我创建了一个Maven项目,并设置了正确的POM.xlm路径文件(至少是我几乎可以确定的路径),并且在解析POM文件时仍然遇到错误,提示文件路径中不存在该文件。 The project does work if maven run it from console or eclipse ide. 如果maven从控制台或Eclipse IDE运行该项目,则该项目确实可以工作。

Here's the stacktrace of the error given by Jenknins. 这是Jenknins给出的错误的堆栈跟踪。

Building in workspace /Users/Shared/Jenkins/Home/workspace/Pagode
Parsing POMs
Discovered a new module com.hugomonteiro:PagodeAutomatedTests PagodeAutomatedTests
Modules changed, recalculating dependency graph
Established TCP socket on 50661
[PagodeAutomatedTests] $ /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin/java -cp /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.12-alpha-1.jar:/usr/local/Cellar/maven/3.5.4/libexec/boot/plexus-classworlds-2.5.2.jar:/usr/local/Cellar/maven/3.5.4/libexec/conf/logging jenkins.maven3.agent.Maven35Main /usr/local/Cellar/maven/3.5.4/libexec /Users/Shared/Jenkins/Home/war/WEB-INF/lib/remoting-3.25.jar /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.12-alpha-1.jar /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.12-alpha-1.jar 50661
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven:  -B -f /Users/hugomonteiro/eclipse-workspace/PagodeAutomatedTests/pom.xml test
[INFO] Scanning for projects...
[HUDSON] Collecting dependencies info
[INFO] 
[INFO] ---------------< com.hugomonteiro:PagodeAutomatedTests >----------------
[INFO] Building PagodeAutomatedTests 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.testng:testng:jar:5.14.3 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.beust:jcommander:jar:1.66 is missing, no dependency information available
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ PagodeAutomatedTests ---
[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.1:compile (default-compile) @ PagodeAutomatedTests ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ PagodeAutomatedTests ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ PagodeAutomatedTests ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ PagodeAutomatedTests ---
[INFO] Surefire report directory: /Users/hugomonteiro/eclipse-workspace/PagodeAutomatedTests/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
Starting ChromeDriver 2.42.591059 (a3d9684d10d61aa0c45f6723b327283be1ebaad8) on port 21561
Only local connections are allowed.
Oct 12, 2018 5:26:39 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 15.043 sec <<< FAILURE! - in TestSuite
doLoginTest(testcases.LoginTest)  Time elapsed: 10.681 sec  <<< FAILURE!
org.openqa.selenium.TimeoutException: Expected condition failed: waiting for visibility of [[ChromeDriver: chrome on MAC (6cf1ac936bdb4be38c29d55651ee5c6b)] -> css selector: [class='fa fa-fw fa-caret-down']] (tried for 10 second(s) with 500 milliseconds interval)
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'Hugos-MacBook-Pro.local', ip: 'fe80:0:0:0:858:ef39:e614:659a%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_181'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.42.591059 (a3d9684d10d61a..., userDataDir: /var/folders/9l/55xyqdlx7gl...}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:50670}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 69.0.3497.100, webStorageEnabled: true}
Session ID: 6cf1ac936bdb4be38c29d55651ee5c6b
    at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:113)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:283)
    at pages.actions.LoginActions.selectLanguage(LoginActions.java:40)
    at pages.actions.LoginActions.doLogin(LoginActions.java:26)
    at testcases.LoginTest.doLoginTest(LoginTest.java:21)

Results :

Failed tests: 
  LoginTest.doLoginTest:21 » Timeout Expected condition failed: waiting for visi...

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

[JENKINS] Recording test results
[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.SurefireArchiver$2; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenArtifactArchiver$2; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[WARNING] Attempt to (de-)serialize anonymous class org.jfrog.hudson.maven2.MavenDependenciesRecorder$1; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenFingerprinter$1; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.760 s
[INFO] Finished at: 2018-10-12T17:26:54+01:00
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project PagodeAutomatedTests: There are test failures.
[ERROR] 
[ERROR] Please refer to /Users/hugomonteiro/eclipse-workspace/PagodeAutomatedTests/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.
[JENKINS] Archiving /Users/hugomonteiro/eclipse-workspace/PagodeAutomatedTests/pom.xml to com.hugomonteiro/PagodeAutomatedTests/0.0.1-SNAPSHOT/PagodeAutomatedTests-0.0.1-SNAPSHOT.pom
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
/Users/hugomonteiro/eclipse-workspace/PagodeAutomatedTests/pom.xml is not inside /Users/Shared/Jenkins/Home/workspace/Pagode/Users/hugomonteiro/eclipse-workspace/PagodeAutomatedTests/; will archive in a separate pass
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
ERROR: Failed to parse POMs
java.nio.file.NoSuchFileException: /Users/Shared/Jenkins/Home/workspace/Pagode/Users/hugomonteiro/eclipse-workspace/PagodeAutomatedTests/pom.xml
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
    at java.nio.file.Files.newByteChannel(Files.java:361)
    at java.nio.file.Files.newByteChannel(Files.java:407)
    at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
    at java.nio.file.Files.newInputStream(Files.java:152)
    at hudson.FilePath.read(FilePath.java:1973)
    at jenkins.plugins.maveninfo.extractor.properties.PomPropertiesFinder.findProperties(PomPropertiesFinder.java:50)
    at jenkins.plugins.maveninfo.extractor.MavenInfoExtractor.extract(MavenInfoExtractor.java:58)
    at jenkins.plugins.maveninfo.extractor.MavenInfoEnvironment.tearDown(MavenInfoEnvironment.java:42)
    at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:908)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
    at hudson.model.Run.execute(Run.java:1819)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
channel stopped
Finished: FAILURE

Any help would be excelent. 任何帮助将是卓越的。 Thanks in advance ! 提前致谢 !

Ok so the problem was : I was hardcoding the pom file from the eclipse workspace directly to the Jenkins pom file path and this is wrong. 好的,问题是:我将Eclipse工作空间中的pom文件直接硬编码为Jenkins pom文件路径,这是错误的。

How I fixed with chrylis help : Moved the project folder to the Jenkins workspace and gave the path from that directory and it worked just fine. 我如何使用chrylis帮助进行修复:将项目文件夹移至Jenkins工作区,并给出了该目录下的路径,并且效果很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM