1

I am trying to use Java samplers in my tests. I have a separate maven project where I create my extensions. After building the project I get a .jar lib. I include it in my maven plugin like this:

 <dependencies>
    <dependency>
        <groupId>com.lazerycode.jmeter</groupId>
        <artifactId>jmeter-maven-plugin</artifactId>
        <version>2.2.0</version>
    </dependency>
    <dependency>
        <groupId>com.qiagen</groupId>
        <artifactId>qa_toolkit</artifactId>
        <version>RELEASE</version>
    </dependency>
    <dependency>
        <groupId>com.qiagen</groupId>
        <artifactId>JMeterExtensions</artifactId>
        <version>jmeter3.2.3</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>com.lazerycode.jmeter</groupId>
            <artifactId>jmeter-maven-plugin</artifactId>
            <version>2.2.0</version>
            <executions>
                <execution>
                    <id>jmeter-tests</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>jmeter</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <testFilesDirectory>${basedir}/src/test/jmeter/</testFilesDirectory>
                <testFilesIncluded>
                    <jMeterTestFile>${jmxTest}</jMeterTestFile>
                </testFilesIncluded>
                <jmeterDirectory>${jmeter.home}</jmeterDirectory>
                <jmeterExtensions>
                    <artifact>com.qiagen:JMeterExtensions:jmeter3.2.3</artifact>
                </jmeterExtensions>
                <propertiesUser>
                    <csvData>${basedir}/src/test/jmeter/${csvData}</csvData>
                    <threads>${threads}</threads>
                    <rampTime>${rampTime}</rampTime>
                    <loopCount>${loopCount}</loopCount>
                    <options>${options}</options>
                    <server>${server}</server>
                    <port>${port}</port>
                    <sleep>${sleep}</sleep>
                    <inputXmlFileDir>${inputXmlFileDir}</inputXmlFileDir>
                    <templatesCsv>${templatesCsv}</templatesCsv>
                    <xmlInputsCsv>${xmlInputsCsv}</xmlInputsCsv>
                    <reportScenariosCsv>${reportScenariosCsv}</reportScenariosCsv>
                </propertiesUser>
                <jMeterProcessJVMSettings>
                    <xms>2048</xms>
                    <xmx>2048</xmx>
                    <arguments>
                        <argument>-Xprof</argument>
                        <argument>-Xfuture</argument>
                    </arguments>
                </jMeterProcessJVMSettings>
            </configuration>
        </plugin>
    </plugins>
</build>

In my extensions i have some invalid transitive dependencies which i excluded from extensions pom.xml. I don't see them in the dependency tree.

When I run the tests, with the flag downloadExtensionDependencies on true, it looks like it tries to download all dependencies (also those excluded) and then the test fails because of that invalid dependency.

Failed to collect dependencies at org.springframework:spring-webmvc:jar:3.1.1.RELEASE -> jasperreports:jasperreports:jar:2.0.5 -> commons-collections:commons-collections:jar:3.2.1.redhat-7: Failed to read artifact descriptor for commons-collections:commons-collections:jar:3.2.1.redhat-7: Could not transfer artifact org.apache.commons:commons-parent:pom:22-redhat-2 from/to jaspersoft (http://www.jasperforge.org/maven2): www.jasperforge.org: Unknown host www.jasperforge.org -> [Help 1]

Do you have any ideas why is the plugin trying to download the excluded dependencies also?

  • When you say you excluded those dependencies, you mean you excluded them in your `pom.xml`? Can you share that portion of the pom to show those exclusions? – palimpsestor May 18 '17 at 16:09
  • what version of plugin are you using ? can you show the full pom ? – UBIK LOAD PACK May 19 '17 at 05:53
  • I excluded the dependencies fro the pom.xml of my extension. Is there a way to exclude them also from main project pom.xml? I am using version 2.2.0 – Daniel Tripon May 19 '17 at 08:06
  • You may also find `mvn dependency:tree` helpful. That will show you what exactly is pulling in your undesired dependencies. – palimpsestor May 19 '17 at 23:25
  • @palimpsestor I also checked that on both extensions and main(where I use the plugin) projects. The dependency that the plugin is trying to download does not appear in the dependency tree. – Daniel Tripon May 22 '17 at 14:23
  • Have a look at this question: https://stackoverflow.com/questions/42268380/how-to-use-perfmon-plugins-with-jmeter-maven-plugin/42345443#42345443 It's the same problem you are seeing with different libraries. There is not way to add specific exclusions for transitive dependencies at the moment (you probably wouldn't want to anyway, transitive dependencies are generally required). – Ardesco Jun 30 '17 at 15:44

1 Answers1

3

Use version 2.6.0 of the plugin which has now better default values like not downloading optional dependencies.

And use this to exclude broken or excluded dependencies:

 <excludedArtifacts>
    <exclusion>commons-pool2:commons-pool2</exclusion>
    <exclusion>commons-math3:commons-math3</exclusion>
    <exclusion>com.sun.jdmk:jmxtools</exclusion>
    <exclusion>com.sun.jmx:jmxri</exclusion>
 </excludedArtifacts>
UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116