Why this post ?
Recently, I was questionned about testing log4j2 and slf4j on an IBM Content Navigator plugin. Because this software load the jar as a “java -jar” execution, there is some formalism to respect.
Prerequisites
Maven 3.6.0
IBM Content Navigator 3.0.3
Pom definition
<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>my.group.id</groupId>
<artifactId>icn-plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/</outputDirectory>
<finalName>IcnPlugin.jar</finalName>
<archive>
<manifestEntries>
<Plugin-Class>my.group.id.IcnPlugin</Plugin-Class>
</manifestEntries>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.11.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.ibm.filenet</groupId>
<artifactId>icn-3.0.0</artifactId>
<version>icn300.000.41</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ibm.ws.javaee</groupId>
<artifactId>servlet</artifactId>
<version>3.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Please follow and like us: