[英]Project runs in Eclipse, but not from command line : java.lang.NoClassDefFoundError with Maven and Dom4J
[英]Maven run batch from command line, java.lang.NoClassDefFoundError
我有maven問題和通過命令行執行java類調用。
我的應用程序使用spring,hibernate和maven。
我的小塊pom.xml是這樣的:
<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>
我嘗試從eclipse和我的應用程序運行,而在命令行上這樣:mvn test -Pimport我有一些錯誤,如:
"nested exception is java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory"
例如:依賴關系如此定義:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.8</version>
<scope>runtime</scope>
</dependency>
有什么建議么?
謝謝
我想你可能有相同的問題,因為這個 。 您的類路徑上也應該有一個實現jar。 例如
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.5.8</version>
</dependency>
你還有什么提到你的pom.xml中的slf4j嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.