gpt4 book ai didi

java - 从 Spring Boot 中排除 Maven 依赖项

转载 作者:行者123 更新时间:2023-12-01 16:53:38 24 4
gpt4 key购买 nike

我有一个 springboot 项目,它将所有依赖的 jar 添加到 lib 文件夹中。我怎样才能避免这种情况?

我试过了,但不起作用

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- <excludeScope>compile</excludeScope>
<excludeArtifactIds>*</excludeArtifactIds>
<excludeGroupIds>*.*</excludeGroupIds> -->
<exclude>
<groupId>*.*</groupId>
<artifactId>*</artifactId>
</exclude>
</configuration>
</plugin>

我不想将依赖项作为提供

还有其他解决方案吗?

最佳答案

您可以通过在 pom.xml 中指定不需要的依赖项来排除。如下所示。

这里我不需要boot提供的嵌入式tomcat。因此我们可以使用以下标签排除它:

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>

关于java - 从 Spring Boot 中排除 Maven 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35769105/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com