【发布时间】:2019-09-19 05:34:12
【问题描述】:
我正在将现有的 Spring 项目迁移到 Spring boot。无法运行 Spring Boot 应用程序并显示以下错误。
错误日志显示 tomcat-embed-core 存在冲突。 在 eclipse 中,porm.xml 的依赖层次如下所示
我排除了 maven 架构师,并尝试运行显示以下错误的应用程序
porm.xml
<modelVersion>4.0.0</modelVersion>
<artifactId>MyService</artifactId>
<packaging>jar</packaging>
<properties>
<java.version>1.8</java.version>
<!-- 2.1.3.RELEASE -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<springframework.boot.version>2.1.7.RELEASE</springframework.boot.version>
</properties>
<name>MyService</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.sybase.jdbc3.jdbc</groupId>
<artifactId>jconn3</artifactId>
<version>${jconn3.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-juli</artifactId>
<version>${tomcat.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>${tomcat.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
这个porm.xml有什么问题
【问题讨论】:
-
您能否也发布完整的 pom.xml 或至少更多,我没有看到 spring-boot-import 您是使用父 pom 还是其他方式?
-
我觉得你不需要导入
tomcat-jdbc,只需要导入spring-boot-starter-web,spring-boot-starter-data-jpa``spring-boot-starter-test就足够了,Ref:github.com/dineshbhagat/spring-boot-web-jpa/blob/master/… -
我正在使用 spring-boot-maven-plugin
-
添加
tomcat-juli的任何具体原因? -
或从start.spring.io 创建虚拟项目,添加所有依赖项并将 pom.xml 与项目的 pom.xml 进行比较
标签: spring spring-boot spring-boot-maven-plugin