> When I try to /run /it in the form of *java -cp > target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App* I get this: > *java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory* > > How come this dependency fails at this late stage?
This line says "run Java with the classpath being my-app.jar and use com.mycompany.app.App as the main/entry class." Java says OK and happily tries to run your file. Then immediately discovers that the classpath you have specified does not include one or more classes - classes that you have declared as dependencies and by using Maven to help manage during the compile process you don't need to worry about the details of your classpath. This is exactly correct. But now you are dealing with run-time, not compile-time. Until now, Maven has ensured that various dependencies are in the classpath -- but note that you are not running Maven, you are running Java, and java does not know anything about Maven's pom and the dependencies etc. So now you need to manually build out that classpath to run your code with a lot more things in the -cp parameter. A far simpler approach is to use the maven-exec-plugin and again let Maven help with your run-time dependencies. Here is a link to that documentation - I'm sure you can sort it out by click a few links and doing 5 minutes of reading: http://mojo.codehaus.org/exec-maven-plugin/ Wayne --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org