Failure to find artefact SLF4J when including it in a maven project that uses jmeter plugin with maria-db connect included

34 views
Skip to first unread message

george.co...@gmail.com

unread,
Jun 26, 2020, 1:46:50 AM6/26/20
to Maven JMeter Plugin Users

Hello guys, got a problem with my test plan.

The jmx file uses a JSR223 sample to run some selenium code and at some point it needs to connect to a maria database to get a code.

pom:


 
<modelVersion>4.0.0</modelVersion>

<groupId>org.example</groupId>
<artifactId>kp-load-test</artifactId>
<version>1.0-SNAPSHOT</version>


<repositories>
   
<repository>
       
<id>sonatype-nexus-snapshots</id>
       
<name>Sonatype Nexus Snapshots</name>
       
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
   
</repository>
</repositories>

<dependencies>
   
<dependency>
       
<groupId>com.codeborne</groupId>
       
<artifactId>selenide</artifactId>
       
<version>5.7.0</version>
   
</dependency>
   
<dependency>
       
<groupId>org.mariadb.jdbc</groupId>
       
<artifactId>mariadb-java-client</artifactId>
       
<version>2.4.0</version>
   
</dependency>


</dependencies>

<build>
   
<plugins>
       
<plugin>
           
<groupId>org.apache.maven.plugins</groupId>
           
<artifactId>maven-compiler-plugin</artifactId>
           
<version>3.6.0</version>
           
<configuration>
               
<source>1.8</source>
               
<target>1.8</target>
           
</configuration>
       
</plugin>
       
<plugin>
           
<groupId>com.lazerycode.jmeter</groupId>
           
<artifactId>jmeter-maven-plugin</artifactId>
           
<version>3.1.0</version>
           
<executions>
               
<!-- Generate JMeter configuration -->
               
<execution>
                   
<id>configuration</id>
                   
<goals>
                       
<goal>configure</goal>
                   
</goals>
               
</execution>
               
<!-- Run JMeter tests -->
               
<execution>
                   
<id>jmeter-tests</id>
                   
<goals>
                       
<goal>jmeter</goal>
                   
</goals>
               
</execution>
               
<!-- Fail build on errors in test -->
               
<execution>
                   
<id>jmeter-check-results</id>
                   
<goals>
                       
<goal>results</goal>
                   
</goals>
               
</execution>
           
</executions>
           
<configuration>
               
<jmeterExtensions>
                   
<artifact>com.codeborne:selenide:5.7.0</artifact>
                   
<artifact>org.mariadb.jdbc:mariadb-java-client:2.4.0</artifact>
               
</jmeterExtensions>

           
</configuration>
       
</plugin>
   
</plugins>
</build>


Running the following command : mvn clean verify throws the following error

[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:3.1.0:configure (configuration) on project kp-load-test: Failure to find org.slf4j:slf4j-api:jar:[1.4.0,1.7.25] in https://oss.sonatype.org/content/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of sonatype-nexus-snapshots has elapsed or updates are forced -> [Help 1]

If i comment the mariadb artifact from jmeterExtensions, the code selenium code will run and throw a driver exception when it reaches the jdbc part.

Looking in the mariadb jar i found the pom contained the following:

<dependency>
       
<groupId>org.slf4j</groupId>
       
<artifactId>slf4j-api</artifactId>
       
<version>[1.4.0,1.7.25]</version>
       
<optional>true</optional>
   
</dependency>

Im hoping im doing something terribly wrong.

Ardesco

unread,
Jun 26, 2020, 4:38:27 AM6/26/20
to Maven JMeter Plugin Users
Looks like an error in the mariadb jar, a version range should be entered as:

     <version>[1.4.0,1.7.25)</version>

*Note that the final character is a ) not a ]

You can work around the issue by specifying this dependency manually in your jmeter extensions block

<jmeterExtensions>
<artifact>com.codeborne:selenide:5.7.0</artifact>
    <artifact>org.slf4j:slf4j-api:[1.4.0,1.7.25)</artifact>

Ardesco

unread,
Jun 26, 2020, 4:45:09 AM6/26/20
to Maven JMeter Plugin Users
Thinking about it a bit more, you may also need to set: 


<downloadExtensionDependencies>false</downloadExtensionDependencies>


This will prevent the plugin from trying to pull down the transitive dependencies for mariadb-java-client, this does mean that you will need to add any required transitive dependencies manually if you need to go down this route.

The real fix is get the mariadb jar fixed to use proper transitive dependency definitions

george.co...@gmail.com

unread,
Jun 26, 2020, 5:09:50 AM6/26/20
to Maven JMeter Plugin Users
You are a life saver.
<downloadExtensionDependencies>false</downloadExtensionDependencies>
This worked and indeed i had to add every dependency manually but its all good.
Thanks a lot.
Reply all
Reply to author
Forward
0 new messages