我尝试使用带有Testng + maven的reporty-ng生成xslt报告但是收到错误
[错误]无法在项目Selenium项目上执行目标org.apache.maven.plugins:maven-site-plugin:3.3:site(default-site):无法获取org.reportyng的报告:reporty-ng:插件org.reportyng:reporty-ng:1.2或其中一个依赖项无法解决:在https://github.com/cosminaru/reporty-ng/raw/master/dist/maven中找不到org.reportyng:reporty-ng:jar:1.2的问题被缓存在本地存储库中,解决方法不会重新尝试直到reporty-ng的更新间隔已经过去或强制更新 - > [帮助1]
以下是pom.xml的一部分:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.48.1</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.6</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-api</artifactId>
<version>2.19</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.5</version>
</dependency>
</dependencies>
<reporting>
<plugins>
<!-- TestNG-xslt related configuration. -->
<plugin>
<groupId>org.reportyng</groupId>
<artifactId>reporty-ng</artifactId>
<version>1.2</version>
<configuration>
<!-- Output directory for the testng xslt report -->
<outputDir>/target/testng-xslt-report</outputDir>
<sortTestCaseLinks>true</sortTestCaseLinks>
<testDetailsFilter>FAIL,SKIP,PASS,CONF,BY_CLASS</testDetailsFilter>
<showRuntimeTotals>true</showRuntimeTotals>
</configuration>
</plugin>
</plugins>
</reporting>
<pluginRepositories>
<pluginRepository>
<id>reporty-ng</id>
<url>https://github.com/cosminaru/reporty-ng/raw/master/dist/maven</url>
</pluginRepository>
</pluginRepositories>
答案 0 :(得分:0)
在我对此的理解中,如果你运行&#34; mvn clean verify&#34;,那将包括&#34; site&#34;构建阶段以及测试。您不应该明确调用网站阶段,因此不要这样做。此外,如果你明确地打电话给&#34;网站&#34;阶段,您可能应该将网站插件作为依赖项包含在内,您认为不是吗?
根据我对TestNG报告和ReportNG报告的体验,网站插件与报告输出无关。该网站插件仅与&#34; Surefire&#34; (或Failsafe)插件报告阶段输出。换句话说,您会注意到Surefire插件的默认输出文件夹与&#34; site&#34;的标准输出位置直接相关。插件,一般来说。我同意,这可能非常令人困惑。
另外,我would configure它(可能)是这样的:
<plugin>
<groupId>org.reportyng</groupId>
<artifactId>reporty-ng</artifactId>
<version>1.4</version>
<configuration>
<outputDirectory>${project.build.directory}/surefire/reportng</outputDirectory>
<sortTestCaseLinks>true</sortTestCaseLinks>
<testDetailsFilter>FAIL,SKIP,PASS,CONF,BY_CLASS</testDetailsFilter>
<showRuntimeTotals>true</showRuntimeTotals>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>2.1</version>
<configuration>
<outputDirectory>${basedir}/target/site</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.9</version>
<configuration>
<outputDirectory>${basedir}/target/site</outputDirectory>
<reportsDirectories>
<reportsDirectories>${basedir}/target/surefire</reportsDirectories>
</reportsDirectories>
</configuration>
<reportSets>
<reportSet>
<id>integration-tests</id>
<reports>
<report>report-only</report>
</reports>
</reportSet>
</reportSets>
</plugin>