我在Jenkins上创建了一个Maven项目,它将从Butbucket克隆一个mercurial分支,所以我可以运行我的Selenium TestNG Scripts。我试过擦除工作区以获得干净的构建,但它导致了与以前相同的错误。另外,我在jenkins工作区中检查了每个模块的pom.xml文件,它们都存在。从控制台单击错误报告的图像。我不明白为什么Jenkins和Eclipse在同一个项目文件夹中找不到我的依赖项的pom.xml文件。
Pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<artifactId>PSWebTestFramework</artifactId>
<groupId>com.guidewire.pstesting</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>pswtf-test-tp-pc</artifactId>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.21</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
</dependency>
<dependency>
<groupId>com.guidewire.pstesting</groupId>
<artifactId>pswtf-application-core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.guidewire.pstesting</groupId>
<artifactId>pswtf-test-core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.guidewire.pstesting</groupId>
<artifactId>pswtf-test-tp-core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.guidewire.pstesting</groupId>
<artifactId>pswtf-application-tp-pc</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.guidewire.pstesting</groupId>
<artifactId>pswtf-application-ootb-pc</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<defaultGoal>test</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<excludes>META-INF/*.SF</excludes>
<excludes>META-INF/*.DSA</excludes>
<excludes>META-INF/*.RSA</excludes>
<argLine>-Dorg.uncommons.reportng.escape-output=false</argLine> <!-- get html in reports rather than string -->
<properties>
<property>
<name>usedefaultlisteners</name>
<value>false</value> <!-- disabling default listeners is optional -->
</property>
<property>
<name>listener</name>
<value>org.uncommons.reportng.HTMLReporter, org.uncommons.reportng.JUnitXMLReporter, org.testng.reporters.XMLReporter</value>
</property>
</properties>
<additionalClasspathElements>
<additionalClasspathElement>${basedir}/src/test/conf</additionalClasspathElement>
<additionalClasspathElement>${basedir}/src/test/testdata</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
更新: 基于下面的解决方案,我改变了我的工作配置,并根据下面的图像,我能够获得成功而不是失败。
答案 0 :(得分:1)
您附加的屏幕截图中的错误意味着工件ID&#34; pswtf-test-tp-pc&#34;无法在本地Maven仓库中找到依赖关系。
使用maven <modules>
标记从父POM构建所有项目。在包含工件ID PSWebTestFramework的父文件夹的pom.xml中添加它。首先运行此父pom,然后从您的项目运行 - pswtf-test-tp-pc
<modules>
<module>pswtf-application-core</module>
<module>pswtf-test-core</module>
<module>pswtf-test-tp-core</module>
<module>pswtf-application-tp-pc</module>
</modules>
这应该构建每个模块并将其安装在本地maven仓库中。
P.S。 - 使用mvn clean install
命令在本地存储库中安装依赖项。