如何删除 tomcat-embedded 依赖?
How to remove tomcat-embedded dependency?
我有一个 spring 启动应用程序,我想在 weblogic 上部署,所以我不需要嵌入式 tomcat 依赖项(否则它会崩溃)。
此 spring 引导应用程序还包含一个库 jar,仅用于编译,需要 spring-boot-starter-web 依赖项。所以,我用 "provided" 为 tomcat dependencies..nervetheless 在决赛中做了以下 poms。war tomcat 仍然存在!有没有办法查看它的来源?没有必要,因为手动将其从我的 .war 中删除使其成功运行...
mylibrary.pom
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
myapplication.pom
<packaging>war</packaging>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
</dependency>
<dependency>
<groupId>com.myself</groupId>
<artifactId>my-library</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-data-22</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifest>
<addDefaultImplementationEntries>false</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
编辑
运行 maven dependency:tree 说是提供了,那为什么在war?
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.2.5.RELEASE:provided
[INFO] | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.31:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.31:provided
[INFO] | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.31:provided
为 tomcat 提供的依赖项是正确的,我的问题是我之前需要进行 mvn 清理:目标目录仍然具有 tomcat 依赖项并且它包含在 war.
我有一个 spring 启动应用程序,我想在 weblogic 上部署,所以我不需要嵌入式 tomcat 依赖项(否则它会崩溃)。
此 spring 引导应用程序还包含一个库 jar,仅用于编译,需要 spring-boot-starter-web 依赖项。所以,我用 "provided" 为 tomcat dependencies..nervetheless 在决赛中做了以下 poms。war tomcat 仍然存在!有没有办法查看它的来源?没有必要,因为手动将其从我的 .war 中删除使其成功运行...
mylibrary.pom
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
myapplication.pom
<packaging>war</packaging>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
</dependency>
<dependency>
<groupId>com.myself</groupId>
<artifactId>my-library</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-data-22</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifest>
<addDefaultImplementationEntries>false</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
编辑 运行 maven dependency:tree 说是提供了,那为什么在war?
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.2.5.RELEASE:provided
[INFO] | +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.31:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.31:provided
[INFO] | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.31:provided
为 tomcat 提供的依赖项是正确的,我的问题是我之前需要进行 mvn 清理:目标目录仍然具有 tomcat 依赖项并且它包含在 war.