从springboot中排除maven依赖项

Rav*_*iga 0 java maven spring-boot

我有一个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>
Run Code Online (Sandbox Code Playgroud)

我不想按提供的方式放置依赖项

还有其他方法吗?

小智 5

您可以通过指定pom中不需要的依赖项来排除.像下面的东西.

这里我不需要通过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>
Run Code Online (Sandbox Code Playgroud)