You have to provide log4j via the classpath on your own.
Maven does include log4j in your generated jar automatically.
But Maven can generate the classpath for you
http://maven.apache.org/plugins/maven-dependency-plugin/usage.html
->dependency:build-classpath
2007/6/26, DCVer <[EMAIL PROTECTED]>:
Hi,
I'm creating a jar using "mvn package". The files, which are included in
this jar are using another jar (e.g. log4j-1.2.14.jar), which are stored
in
maven repository. My part of pom.xml file responsible for dependencies
looks
like:
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<scope>compile</scope>
<type>jar</type>
</dependency>
The "mvn package" process finishes correctly, but when i run the jar
using:
java -cp target\my-app-1.0-SNAPSHOT.jar com.mycompany.app.App
i receive the error:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/log4j/Logger
(on line:
private static Logger logger = Logger.getLogger("com.mycompany.app.App");
In my opinion the jar, that was created using "mvn package" doesn't know
about dependencies (and about jars stored in repository?). How should I
set
classpaths and make this jar work correctly? Isn't it a BASIC
functionality,
that Maven2 should do, when I set <dependency> in pom.xml file?
I tried this with other jars (in repository) and other methods of the
classes included in jars and the results were exactly the same.
--
View this message in context:
http://www.nabble.com/adding-the-classpath-to-jar-file-tf3982263s177.html#a11305225
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]