Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
“运行”;mvn测试现场“;giving[ERROR]未能在项目上执行目标org.apache.maven.plugins:maven站点plugin:3.3:site(默认站点)_Maven_Selenium_Xslt - Fatal编程技术网

“运行”;mvn测试现场“;giving[ERROR]未能在项目上执行目标org.apache.maven.plugins:maven站点plugin:3.3:site(默认站点)

“运行”;mvn测试现场“;giving[ERROR]未能在项目上执行目标org.apache.maven.plugins:maven站点plugin:3.3:site(默认站点),maven,selenium,xslt,Maven,Selenium,Xslt,我试图使用reporty ng和Testng+maven生成xslt报告,但得到的错误如下 [错误]无法执行目标org.apache.maven.plugins:maven站点plugin:3.3:site(默认站点)在project Selenium项目上:未能获取org.reportyng:reporty ng:Plugin org.reportyng:reporty ng:1.2的报告或无法解决其依赖项之一:未能在本地存储库中缓存中找到org.reportyng:reporty ng:ja

我试图使用reporty ng和Testng+maven生成xslt报告,但得到的错误如下

[错误]无法执行目标org.apache.maven.plugins:maven站点plugin:3.3:site(默认站点)在project Selenium项目上:未能获取org.reportyng:reporty ng:Plugin org.reportyng:reporty ng:1.2的报告或无法解决其依赖项之一:未能在本地存储库中缓存中找到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>

org.apache.maven.plugins
maven surefire插件
2.19.1
testng.xml
真的
org.apache.maven.plugins
maven编译器插件
3.3
1.7
1.7
org.seleniumhq.selenium
硒爪哇
2.48.1
org.testng
testng
6.9.6
org.apache.maven.surefire
SurefireAPI
2.19
log4j
log4j
1.2.17
org.apache.httpcomponents
httpclient
4.3.5
org.reportyng
报告性ng
1.2
/目标/testng xslt报告
真的
失败、跳过、通过、配置、按类
真的
报告性ng
https://github.com/cosminaru/reporty-ng/raw/master/dist/maven

根据我的理解,如果运行“mvn clean verify”,将包括构建的“站点”阶段以及测试。您不需要显式地调用站点阶段,因此不要这样做。另外,如果要显式地调用“站点”阶段,您可能应该将站点插件作为依赖项包括在内,您不这样认为吗

根据我使用TestNG报告和ReportNG报告的经验,站点插件与报告输出无关。站点插件仅与报告阶段输出的“Surefire”(或故障保护)插件相关。换句话说,您会注意到Surefire插件的默认输出文件夹通常与“站点”插件的标准输出位置直接相关。我同意,这可能会让人非常困惑

此外,我(可能)喜欢这样:


org.reportyng
报告性ng
1.4
${project.build.directory}/surefire/reportng
真的
失败、跳过、通过、配置、按类
真的
org.apache.maven.plugins
maven站点插件
2.1
${basedir}/target/site
org.apache.maven.plugins
maven surefire报告插件
2.9
${basedir}/target/site
${basedir}/target/surefire
集成测试
仅报告

考虑使用ExtentReports而不是Reporting,因为后者不再受支持。感谢您的回复,我使用了与您在上述配置中建议的相同的方式,并使用命令“mvn clean verify”运行。虽然观察到构建成功,但未生成报告文件。你能帮我一下吗?如果这里出了什么问题,请告诉我好吗?@Ankit-我建议你从简化事情开始。您应该能够让ReportNG插件在没有maven站点插件和maven surefire报告插件的情况下工作。尝试完全按照网站文档的建议设置Reporting,而无需添加额外的配置参数。然后,您应该看到ReportNG报告被放置在surefire输出文件夹中(默认情况下)。@Ankit-如果有帮助,我曾经编写过一个TestNG报告的示例。以下是网址:
<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>