Project's main jar is removed from jmeter/lib (as duplicate) when test jar also added to testPlanLibraries

28 views
Skip to first unread message

Shawn McKinney

unread,
Jan 10, 2022, 11:31:18 AMJan 10
to Maven JMeter Plugin Users
Hello,

I have a problem where the project's main and test jars can't both be added as test plan dependencies:

```
<testPlanLibraries>
  <artifact>org.apache.directory.fortress:fortress-core:jar:tests:${project.version}</artifact>
  <artifact>org.apache.directory.fortress:fortress-core:${project.version}</artifact>
   ...
</testPlanLibraries>
```

Specifically, I need both of these present:

fortress-core-[VERSION]-tests.jar
fortress-core-[VERSION].jar

I can add one or the other but not both, presumably, because the plugin is removing the second as a duplicate.

Is there a way to work around this problem?  I searched but couldn't find a way.  Please advise.

Thanks

--
Shawn

Shawn McKinney

unread,
Jan 11, 2022, 9:52:00 AMJan 11
to Maven JMeter Plugin Users
Note, combining a project's core and test-jar's was supported in earlier version of the maven jmeter plugin.

```
  <plugin>
    <groupId>com.lazerycode.jmeter</groupId>
    <artifactId>jmeter-maven-plugin</artifactId>
    <version>1.10.1</version>
    ...
   
    <dependencies>
      <dependency>
        <groupId>org.apache.directory.fortress</groupId>
        <artifactId>fortress-core</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.directory.fortress</groupId>
        <artifactId>fortress-core</artifactId>
        <type>test-jar</type>
        <version>${project.version}</version>
      </dependency>
      ...
    </dependencies>
  </plugin>
```
Thanks,
--
Shawn

Shawn McKinney

unread,
Jan 19, 2022, 9:18:53 AMJan 19
to Maven JMeter Plugin Users
With @ardesco's help, this problem was solved.  I was wrong about the jar being removed as duplicate.  It wasn't being removed, the plugin was executing before the project's jar was being built.  Read about it here:  [1](https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/issues/418#issuecomment-1013903410).

So, now the explanation of 'why' the project jar wasn't available during execution, the next question is 'how' do we make this work?  Read about that here: [2](https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/issues/418#issuecomment-1014218250)

For a working example, you can view the pom of project1: [apache-fortress-core](https://github.com/apache/directory-fortress-core/blob/master/pom.xml#L809) and [ldap-load-gen](https://gitlab.symas.net/symas-public/ldap-load-gen/-/blob/main/pom.xml#L187).

I expect this is a common usage pattern.  That where the project's pom both produces a jar and needs to run load tests against the contents of that jar.  If this is you, these examples should help.

--
Shawn
Reply all
Reply to author
Forward
0 new messages