1

我正在尝试实现 Jmeter Maven 集成。当我尝试使用 jmeter-maven-plugin 时,我收到了以下 stackoverflow 问题中提到的错误消息:

使用 Jmeter Maven 插件运行 JMX 监视器收集器侦听器

我按照上面博客中的建议更改了我的 pom.xml,但现在没有收到该错误(原因:com.thoughtworks.xstream.converters.ConversionException:kg.apc.jmeter.jmxmon.JMXMonCollector:kg.apc.jmeter。 jmxmon.JMXMonCollector)。但是,这并没有解决我的执行问题,现在我面临以下错误。

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.128 s
[INFO] Finished at: 2016-03-09T09:22:01+05:30
[INFO] Final Memory: 46M/958M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:1.10.1:jmeter (jmeter-tests) on project medewerkers-it: Execut
ion jmeter-tests of goal com.lazerycode.jmeter:jmeter-maven-plugin:1.10.1:jmeter failed: Plugin com.lazerycode.jmeter:jmeter-maven-plug
in:1.10.1 or one of its dependencies could not be resolved: Failed to collect dependencies at com.lazerycode.jmeter:jmeter-maven-plugin
:jar:1.10.1 -> kg.apc:jmeter-plugins:jar:1.0.0 -> org.apache.hbase:hbase:jar:0.90.1-cdh3u0 -> org.apache.thrift:thrift:jar:0.2.0: Faile
d to read artifact descriptor for org.apache.thrift:thrift:jar:0.2.0: Could not transfer artifact org.apache.thrift:thrift:pom:0.2.0 fr
om/to cdh.snapshot.repo (https://repository.cloudera.com/content/repositories/snapshots): Failed to transfer file: https://repository.c
loudera.com/content/repositories/snapshots/org/apache/thrift/thrift/0.2.0/thrift-0.2.0.pom. Return code is: 409 , ReasonPhrase:Conflict
. -> [Help 1]
[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

我尝试更改各种版本,但无法解决此问题。下面是我正在使用的 pom.xml。任何人都可以在这方面提供帮助。

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <properties>
        <skipITTests>true</skipITTests>
        <geb.version>0.10.0</geb.version>
        <selenium.version>2.48.2</selenium.version>
        <groovy.version>2.3.6</groovy.version>
        <spock.version>0.7-groovy-2.0</spock.version>
        <gson.version>2.3.1</gson.version>
        <httpclient.version>4.3.4</httpclient.version>
        <httpcore.version>4.3.2</httpcore.version>
        <surefire.plugin.version>2.12.4</surefire.plugin.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.spockframework</groupId>
            <artifactId>spock-core</artifactId>
            <version>${spock.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-all</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.gebish</groupId>
            <artifactId>geb-spock</artifactId>
            <version>${geb.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>${selenium.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.google.code.gson</groupId>
                    <artifactId>gson</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>${gson.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient.version}</version>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire.plugin.version}</version>
                <configuration>
                    <skipTests>${skipITTests}</skipTests>
                    <includes>
                        <include>*Spec.*</include>
                    </includes>
                    <systemPropertyVariables>
                        <geb.build.reportsDir>target/test-reports/geb</geb.build.reportsDir>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>gmaven-plugin</artifactId>
                <version>1.4</version>
                <configuration>
                    <providerSelection>1.8</providerSelection>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.gmaven.runtime</groupId>
                        <artifactId>gmaven-runtime-1.8</artifactId>
                        <version>1.4</version>
                        <exclusions>
                            <exclusion>
                                <groupId>org.codehaus.groovy</groupId>
                                <artifactId>groovy-all</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-all</artifactId>
                        <version>${groovy.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.spockframework</groupId>
                        <artifactId>spock-core</artifactId>
                        <version>${spock.version}</version>
                        <exclusions>
                            <exclusion>
                                <groupId>org.codehaus.groovy</groupId>
                                <artifactId>groovy-all</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                </dependencies>
            </plugin>   

            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.1</version>
            <configuration>
               <source>1.8</source>
               <target>1.8</target>
            </configuration>
         </plugin>

         <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-maven-plugin</artifactId>
                <version>1.10.1</version>
                <executions>
                    <execution>
                        <id>jmeter-tests</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jmeter</goal>
                        </goals>
                        <configuration>
                            <reportDir>${project.build.directory}/jmeter-reports</reportDir>

                                <jmeterPlugins>
                                    <plugin>
                                        <groupId>kg.apc</groupId>
                                        <artifactId>jmeter-plugins</artifactId>
                                    </plugin>

                                </jmeterPlugins>

                        </configuration>
                    </execution>
                </executions>

                <dependencies>
                        <dependency>
                            <groupId>kg.apc</groupId>
                            <artifactId>jmeter-plugins</artifactId>
                            <version>1.0.0</version>
                        </dependency>
                </dependencies>

            </plugin>

             <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>xml-maven-plugin</artifactId>
           <version>1.0-beta-2</version>
           <executions>
               <execution>
               <phase>pre-site</phase>
               <goals>
                   <goal>transform</goal>
               </goals>
               </execution>
           </executions>
           <configuration>
               <transformationSets>
                   <transformationSet>
                       <dir>${project.build.directory}/jmeter-reports</dir>
                       <stylesheet>src/test/resources/jmeter-results-detail-report_21.xsl</stylesheet>
                       <outputDir>${project.build.directory}/site/jmeter-results</outputDir>
                       <fileMappers>
                           <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
                               <targetExtension>html</targetExtension>
                           </fileMapper>
                       </fileMappers>
                   </transformationSet>
               </transformationSets>
           </configuration>
       </plugin>

        </plugins>
    </build>    
</project>

我也故意提到了其他依赖项,只是为了清楚地了解情况。提前致谢!

下面是我刚刚更改的 pom.xml,但仍然面临附件中提到的错误

[![<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>


    <!-- IMPORTANT NOTE -->
    <!--
        This pom.xml does not contain a parent dependency to the webapplications pom.xml.
        Due to conflicting dependencies, the parent dependency was removed by Lieven Rigo and the Indian team, with consent of Andy Verberne.

        The child dependency in the webapplications pom.xml has also been removed.
        This means that maven-wise, the integration test set is a separate project.

    -->

    <groupId>net.atos.esuite.webapplications</groupId>
    <artifactId>medewerkers-it</artifactId>
    <version>4.5.0.7-SNAPSHOT</version>
    <packaging>jar</packaging>

    <!-- Project information -->
    <name>Atos e-Suite : Webapplications : Medewerkers IT testen</name>

    <properties>
        <skipITTests>true</skipITTests>
        <geb.version>0.10.0</geb.version>
        <selenium.version>2.48.2</selenium.version>
        <groovy.version>2.3.6</groovy.version>
        <spock.version>0.7-groovy-2.0</spock.version>
        <gson.version>2.3.1</gson.version>
        <httpclient.version>4.3.4</httpclient.version>
        <httpcore.version>4.3.2</httpcore.version>
        <surefire.plugin.version>2.12.4</surefire.plugin.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.spockframework</groupId>
            <artifactId>spock-core</artifactId>
            <version>${spock.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-all</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.gebish</groupId>
            <artifactId>geb-spock</artifactId>
            <version>${geb.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>${selenium.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.google.code.gson</groupId>
                    <artifactId>gson</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>${gson.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- Newly added dependencies-->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <!--
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
        </dependency>
        -->
        <!--
        <dependency>
            <groupId>kg.apc</groupId>
            <artifactId>jmeter-plugins-extras</artifactId>
            <version>1.1.3</version>
        </dependency>


        <dependency>
            <groupId>org.apache.thrift</groupId>
            <artifactId>libthrift</artifactId>
            <version>0.6.1</version>
        </dependency>

        <dependency>
            <groupId>kg.apc</groupId>
            <artifactId>jmeter-plugins-common</artifactId>
            <version>1.1.3</version>
        </dependency>
        -->
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire.plugin.version}</version>
                <configuration>
                    <skipTests>${skipITTests}</skipTests>
                    <includes>
                        <include>*Spec.*</include>
                    </includes>
                    <systemPropertyVariables>
                        <geb.build.reportsDir>target/test-reports/geb</geb.build.reportsDir>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>gmaven-plugin</artifactId>
                <version>1.4</version>
                <configuration>
                    <providerSelection>1.8</providerSelection>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.gmaven.runtime</groupId>
                        <artifactId>gmaven-runtime-1.8</artifactId>
                        <version>1.4</version>
                        <exclusions>
                            <exclusion>
                                <groupId>org.codehaus.groovy</groupId>
                                <artifactId>groovy-all</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-all</artifactId>
                        <version>${groovy.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.spockframework</groupId>
                        <artifactId>spock-core</artifactId>
                        <version>${spock.version}</version>
                        <exclusions>
                            <exclusion>
                                <groupId>org.codehaus.groovy</groupId>
                                <artifactId>groovy-all</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                </dependencies>
            </plugin>

            <!-- Newly added plugins-->
            <!--            
            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.1</version>
            <configuration>
               <source>1.8</source>
               <target>1.8</target>
            </configuration>
         </plugin>
         -->
         <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-maven-plugin</artifactId>
                <version>1.10.1</version>
                <executions>
                    <execution>
                        <id>jmeter-tests</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jmeter</goal>
                        </goals>
                        <configuration>
                            <reportDir>${project.build.directory}/jmeter-reports</reportDir>

                                <jmeterPlugins>
                                    <plugin>
                                        <groupId>kg.apc</groupId>
                                        <artifactId>jmeter-plugins</artifactId>
                                    </plugin>

                                </jmeterPlugins>

                        </configuration>
                    </execution>
                </executions>

                <dependencies>
                        <dependency>
                            <groupId>kg.apc</groupId>
                            <artifactId>jmeter-plugins</artifactId>
                            <version>1.0.0</version>
                        </dependency>
                </dependencies>

            </plugin>


             <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>xml-maven-plugin</artifactId>
           <version>1.0-beta-2</version>
           <executions>
               <execution>
               <phase>pre-site</phase>
               <goals>
                   <goal>transform</goal>
               </goals>
               </execution>
           </executions>
           <configuration>
               <transformationSets>
                   <transformationSet>
                       <dir>${project.build.directory}/jmeter-reports</dir>
                       <stylesheet>src/test/resources/jmeter-results-detail-report_21.xsl</stylesheet>
                       <outputDir>${project.build.directory}/site/jmeter-results</outputDir>
                       <fileMappers>
                           <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
                               <targetExtension>html</targetExtension>
                           </fileMapper>
                       </fileMappers>
                   </transformationSet>
               </transformationSets>
           </configuration>
       </plugin>

        </plugins>
    </build>

    <!--
     <repositories>
        <repository>
            <releases>
                <enabled>false</enabled>
                <updatePolicy>always</updatePolicy>
                <checksumPolicy>warn</checksumPolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            <checksumPolicy>fail</checksumPolicy>
            </snapshots>
            <id>codehausSnapshots</id>
            <name>Codehaus Snapshots</name>
            <url>http://snapshots.maven.codehaus.org/maven2</url>
            <layout>default</layout>
        </repository>
    </repositories>

    -->


    <!--
    <repositories>
        <repository>
    <id>central</id>
    <url>http://repo1.maven.org/maven2/</url>
  </repository>
    </repositories>
    -->
    <pluginRepositories>
    <pluginRepository>
        <id>sonatype-snapshots</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </pluginRepository>
</pluginRepositories>

</project>][1]][1]
4

2 回答 2

0

使用插件的 2.6.0 版本

它现在管理更好的依赖关系并具有智能默认值。

如果您仍然需要排除一些工件,您可以使用:

 <excludedArtifacts>
      <exclusion>commons-pool2:commons-pool2</exclusion>
 </excludedArtifacts>
于 2017-12-01T22:39:57.920 回答
0
于 2016-03-11T07:56:35.450 回答