Java 具有多个模块的Maven项目无法找到模块的pom.xml-Jenkins/Eclipse
我在Jenkins上创建了一个Maven项目,它将从Butbucket克隆一个mercurial分支,这样我就可以运行Selenium TestNG脚本。我曾尝试删除工作区以获得一个干净的构建,但它导致了与以前相同的错误。此外,我还检查了jenkins工作区中每个模块的pom.xml文件,它们都存在。单击控制台中错误报告的图像。我不明白为什么Jenkins和Eclipse在同一个项目文件夹中都找不到依赖项的pom.xml文件 Pom.xmlJava 具有多个模块的Maven项目无法找到模块的pom.xml-Jenkins/Eclipse,java,eclipse,maven,jenkins,testng,Java,Eclipse,Maven,Jenkins,Testng,我在Jenkins上创建了一个Maven项目,它将从Butbucket克隆一个mercurial分支,这样我就可以运行Selenium TestNG脚本。我曾尝试删除工作区以获得一个干净的构建,但它导致了与以前相同的错误。此外,我还检查了jenkins工作区中每个模块的pom.xml文件,它们都存在。单击控制台中错误报告的图像。我不明白为什么Jenkins和Eclipse在同一个项目文件夹中都找不到依赖项的pom.xml文件 Pom.xml <?xml version="1.0" enc
<?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>
4.0.0
您附加的屏幕截图中的错误意味着工件id“pswtf test tp pc”无法在本地Maven repo中找到依赖项
使用maven
标记从父POM构建所有项目。将其添加到工件id为PSWebTestFramework的父文件夹中的pom.xml中。首先运行这个父pom,然后从您的项目-pswtf测试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>
pswtf应用核心
pswtf试验堆芯
pswtf测试tp核心
pswtf应用程序tp-pc
这应该构建每个模块并将其安装在本地maven repo中
注意-使用mvn clean install
命令在本地repo中安装依赖项。我的父pom.xml文件中已经有一个modules标记,并尝试使用该命令,但未成功。它会导致testng异常,我认为这意味着它开始执行selenium脚本,但在没有要加载的testng.xml文件时失败了。感谢您的帮助。我在Jenkins的目标中添加了“干净安装”,构建成功。