Reputation: 31
I have a problem with maven and the execution of a java class call through the command line.
My application uses spring,hibernate and maven.
My little piece of pom.xml is this:
<profile>
<id>import</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
<phase>test</phase>
<configuration>
<mainClass>com.mycompany.App</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
I tried to run from eclipse and my application works, while on the command line like this: mvn test -Pimport I have some errors like:
"nested exception is java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory"
Eg: dependency is so defined:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.8</version>
<scope>runtime</scope>
</dependency>
any suggestions?
Thanks
Upvotes: 0
Views: 212
Reputation: 67310
I think you may have the same issue as this. You should have an implementation jar on your classpath, too. For example
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.5.8</version>
</dependency>
Do you have anything else that mentions slf4j in your pom.xml?
Upvotes: 2