【发布时间】:2013-05-24 23:58:00
【问题描述】:
我在使用 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 测试 -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>
有什么建议吗?
谢谢
【问题讨论】:
标签: java maven command-line