Before I ask the question here, I looked on internet. I found other questions with exactly the same titles, but I couldn't find the solution, or the solution proposed didn't work for me.
I am using Maven, with the following configuration:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.3</version>
</dependency>
It compiles and works well when I run the application from the IDE (IntelliJ). However, when I create a jar file and try to run the main class, I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at dpsng.pgs.ValidationTool.<clinit>(ValidationTool.java:26)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
I read several answers indicating to download jar files manually, I absolutely want to avoid this kind of solution.
What do I do wrong? Thanks!