java - 'mvn -v' work,but'mvn' or 'mvn compile' throw an exception -
i'm new maven. had downloaded , unpacked it. had added bin directory system path. 'mvn -v' work well, see
```
apache maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-15t01:29:23+08:00) maven home: d:\apache-maven-3.2.5\bin\.. java version: 1.8.0_101, vendor: oracle corporation java home: d:\program files\java\jdk1.8.0_101\jre default locale: zh_cn, platform encoding: gbk os name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
```
however, when tried compile java project using 'mvn compile', threw exception. project consists of pom.xml file , 2 java file tutorial https://spring.io/guides/gs/maven/#initial. exception says,
```
e:\code\java\test_maven>mvn compile slf4j: failed load class "org.slf4j.impl.staticloggerbinder" slf4j: see http://www.slf4j.org/codes.html#staticloggerbinder further details. constituent[0]: file:/d:/apache-maven-3.2.5/bin/../lib/aether-api-1.0.0.v20140518.jar constituent[1]: file:/d:/apache-maven-3.2.5/bin/../lib/aether-connector-basic-1.0.0.v20140518.jar constituent[2]: file:/d:/apache-maven-3.2.5/bin/../lib/aether-impl-1.0.0.v20140518.jar constituent[3]: file:/d:/apache-maven-3.2.5/bin/../lib/aether-spi-1.0.0.v20140518.jar constituent[4]: file:/d:/apache-maven-3.2.5/bin/../lib/aether-transport-wagon-1.0.0.v20140518.jar constituent[5]: file:/d:/apache-maven-3.2.5/bin/../lib/aether-util-1.0.0.v20140518.jar constituent[6]: file:/d:/apache-maven-3.2.5/bin/../lib/aopalliance-1.0.jar constituent[7]: file:/d:/apache-maven-3.2.5/bin/../lib/cdi-api-1.0.jar constituent[8]: file:/d:/apache-maven-3.2.5/bin/../lib/commons-cli-1.2.jar constituent[9]: file:/d:/apache-maven-3.2.5/bin/../lib/commons-io-2.2.jar constituent[10]: file:/d:/apache-maven-3.2.5/bin/../lib/commons-lang-2.6.jar constituent[11]: file:/d:/apache-maven-3.2.5/bin/../lib/guava-18.0.jar constituent[12]: file:/d:/apache-maven-3.2.5/bin/../lib/javax.inject-1.jar constituent[13]: file:/d:/apache-maven-3.2.5/bin/../lib/jsoup-1.7.2.jar constituent[14]: file:/d:/apache-maven-3.2.5/bin/../lib/jsr250-api-1.0.jar constituent[15]: file:/d:/apache-maven-3.2.5/bin/../lib/maven-aether-provider-3.2.5.jar constituent[16]: file:/d:/apache-maven-3.2.5/bin/../lib/maven-artifact-3.2.5.jar constituent[17]: file:/d:/apache-maven-3.2.5/bin/../lib/maven-compat-3.2.5.jar constituent[18]: file:/d:/apache-maven-3.2.5/bin/../lib/maven-core-3.2.5.jar constituent[19]: file:/d:/apache-maven-3.2.5/bin/../lib/maven-embedder-3.2.5.jar constituent[20]: file:/d:/apache-maven-3.2.5/bin/../lib/maven-model-3.2.5.jar constituent[21]: file:/d:/apache-maven-3.2.5/bin/../lib/maven-model-builder-3.2.5.jar constituent[22]: file:/d:/apache-maven-3.2.5/bin/../lib/maven-plugin-api-3.2.5.jar constituent[23]: file:/d:/apache-maven-3.2.5/bin/../lib/maven-repository-metadata-3.2.5.jar constituent[24]: file:/d:/apache-maven-3.2.5/bin/../lib/maven-settings-3.2.5.jar constituent[25]: file:/d:/apache-maven-3.2.5/bin/../lib/maven-settings-builder-3.2.5.jar constituent[26]: file:/d:/apache-maven-3.2.5/bin/../lib/org.eclipse.sisu.inject-0.3.0.m1.jar constituent[27]: file:/d:/apache-maven-3.2.5/bin/../lib/org.eclipse.sisu.plexus-0.3.0.m1.jar constituent[28]: file:/d:/apache-maven-3.2.5/bin/../lib/plexus-cipher-1.7.jar constituent[29]: file:/d:/apache-maven-3.2.5/bin/../lib/plexus-component-annotations-1.5.5.jar constituent[30]: file:/d:/apache-maven-3.2.5/bin/../lib/plexus-interpolation-1.21.jar constituent[31]: file:/d:/apache-maven-3.2.5/bin/../lib/plexus-sec-dispatcher-1.3.jar constituent[32]: file:/d:/apache-maven-3.2.5/bin/../lib/plexus-utils-3.0.20.jar constituent[33]: file:/d:/apache-maven-3.2.5/bin/../lib/sisu-guice-3.2.3-no_aop.jar constituent[34]: file:/d:/apache-maven-3.2.5/bin/../lib/slf4j-api-1.7.5.jar constituent[35]: file:/d:/apache-maven-3.2.5/bin/../lib/slf4j-simple-1.7.5.jar constituent[36]: file:/d:/apache-maven-3.2.5/bin/../lib/wagon-file-2.8.jar constituent[37]: file:/d:/apache-maven-3.2.5/bin/../lib/wagon-http-2.8-shaded.jar constituent[38]: file:/d:/apache-maven-3.2.5/bin/../lib/wagon-http-shared-2.8.jar constituent[39]: file:/d:/apache-maven-3.2.5/bin/../lib/wagon-provider-api-2.8.jar constituent[40]: file:/d:/apache-maven-3.2.5/bin/../conf/logging/ exception in thread "main" java.lang.noclassdeffounderror: org/slf4j/impl/staticloggerbinder @ org.slf4j.loggerfactory.getsingleton(loggerfactory.java:230) @ org.slf4j.loggerfactory.bind(loggerfactory.java:121) @ org.slf4j.loggerfactory.performinitialization(loggerfactory.java:112) @ org.slf4j.loggerfactory.getiloggerfactory(loggerfactory.java:275) @ org.apache.maven.cli.mavencli.logging(mavencli.java:311) @ org.apache.maven.cli.mavencli.domain(mavencli.java:207) @ org.apache.maven.cli.mavencli.main(mavencli.java:160) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:498) @ org.codehaus.plexus.classworlds.launcher.launcher.launchenhanced(launcher.java:289) @ org.codehaus.plexus.classworlds.launcher.launcher.launch(launcher.java:229) @ org.codehaus.plexus.classworlds.launcher.launcher.mainwithexitcode(launcher.java:415) @ org.codehaus.plexus.classworlds.launcher.launcher.main(launcher.java:356) caused by: java.lang.classnotfoundexception: org.slf4j.impl.staticloggerbinder @ java.net.urlclassloader.findclass(urlclassloader.java:381) @ java.lang.classloader.loadclass(classloader.java:424) @ java.lang.classloader.loadclass(classloader.java:357) 15 more
```
i'v google days solution find nothing. please me maven learning. sooooooooooooooo much
i think need add following dependency in pom
<dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> <version>1.5.6</version> </dependency>
try , let know if worked
Comments
Post a Comment