[英]Spring Boot 2 project works in IDE but not command line
I am running a Spring Boot project. 我正在运行一个Spring Boot项目。 I can run the project from IntelliJ, however when I try and do
mvn spring-boot:run
I get java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
我可以从IntelliJ运行项目,但是当我尝试执行
mvn spring-boot:run
我得到java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
I have included 我已经包括
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0</version>
</dependency>
in my pom.xml file. 在我的pom.xml文件中。 I have even included
java.xml.bind
as an add modules in the pom. 我什至在pom中将
java.xml.bind
包含为添加模块。 But the issue still persists. 但是问题仍然存在。 What am I missing?
我想念什么?
Credit to @jny for the answer 归功于@jny的答案
I had the wrong dependency in the pom file. 我在pom文件中有错误的依赖性。 Replacing it with
替换为
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
corrected the issue. 更正了该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.