'Upgrade log4j in apache jmeter core maven
I'm fairly new to maven, so bear with me.
I have this dependency in pom.xml
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>5.4.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.jmeter/ApacheJMeter_java -->
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_java</artifactId>
<version>5.4.3</version>
</dependency>
These dependencies contain log4j version 2.11.2 and i want to update them to atleast 2.17.1 (i think thats the latest version, not sure).
Is there a way to explicitly update these version numbers, as 5.4.3 is the latest version of jmeter core and its not log4j compliant.
I use the plugin
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>3.1.0</version>
and that isnt updating to 5.4.3 either. i kinda need some help making this jmeter code log4j compliant.
Solution 1:[1]
Try adding dependency as dependency-management in your POM.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.log4j</groupId>
<artifactId>log4j-artifactid</artifactId>
<version>${log4j-version}</version>
</dependency>
</dependencies>
</dependencyManagement>
Solution 2:[2]
jmeter-maven-pluginversion3.1.0will give you JMeter 5.3 no matter what you specify in the<dependencies>section.- The latest version is 3.5.0 which gives you JMeter 5.4.1
So you will either need to wait for the next release or to explicitly specify the desired JMeter version like:
<configuration>
<jmeterVersion>5.4.3</jmeterVersion>
</configuration>
Full pom.xml just in case
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>jmeter-maven</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>3.5.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>
<jmeterVersion>5.4.3</jmeterVersion>
</configuration>
</plugin>
</plugins>
</build>
</project>
More information: How to Use the JMeter Maven Plugin
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sharad |
| Solution 2 | Dmitri T |
