我创建了Selenium IDE测试用例并在Eclipse中测试过它们。该项目是一个Maven java项目,测试将在Eclipse中正常运行,但是当我将项目添加到Jenkins并尝试构建我的项目时,会出现错误和构建失败。
错误:
Started by user anonymous
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Selenium IDE Recon
Parsing POMs
Discovered a new module Test:SeleniumTest SeleniumTest
Modules changed, recalculating dependency graph
[Selenium IDE Recon] $ C:\java/bin/java -cp "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-agent-1.5.jar;C:\Users\MC44948\Software\springsource\springsource\apache-maven-3.0.4\boot\plexus-classworlds-2.4.jar" org.jvnet.hudson.maven3.agent.Maven3Main C:\Users\MC44948\Software\springsource\springsource\apache-maven-3.0.4 "C:\Program Files (x86)\Jenkins\war\WEB-INF\lib\remoting-2.45.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-1.5.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.5.jar" 53032
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f C:\Users\MC44948\Spring_Workspace\Selenium IDE Recon\pom.xml install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SeleniumTest 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.671s
[INFO] Finished at: Mon Sep 29 11:46:35 BST 2014
[INFO] Final Memory: 4M/8M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org -> [Help 1]
[JENKINS] Archiving C:\Users\MC44948\Spring_Workspace\Selenium IDE Recon\pom.xml to Test/SeleniumTest/0.0.1-SNAPSHOT/SeleniumTest-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/PluginResolutionException
channel stopped
Finished: FAILURE
我的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>Test</groupId>
<artifactId>SeleniumTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>SeleniumTest</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.43.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.opera</groupId>
<artifactId>operadriver</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>2.43.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.6.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.opera</groupId>
<artifactId>operadriver</artifactId>
<version>0.16</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
</project>
答案 0 :(得分:1)
这似乎与互联网连接有关。您是否注意到错误:"Unknown host repo.maven.apache.org"
?
尝试wget http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom
,看看是否可以获取数据。
有关详细信息,请参阅this链接。
答案 1 :(得分:1)
我的Java项目在从命令行构建时成功构建,但在使用Jenkins构建时,我收到错误“Unknown host repo.maven.apache.org”。
问题是我们公司正在使用的自定义maven设置文件。
所以你可以做的是:在工作配置,构建部分下,单击“高级...”。 将“设置文件”设置为“文件系统中的设置文件”,并从maven安装位置提供设置文件的路径。例如 C:\ Program Files \ apache-maven-3.1.1 \ conf \ settings.xml
将“全局设置文件”设置为“文件系统上的全局设置文件”,并提供“$ {user.home} /的路径。平方米/ settings.xml中“即可。
答案 2 :(得分:0)
您可能会支持合作代理(或任何其他代理\防火墙)。 确保您可以从正在运行构建的从属设备访问maven central。
如果没有 - 在您的服务器上配置您的http_proxy和https_proxy。