Ravindra Devadiga
Ravindra Devadiga

Reputation: 692

Exclude maven dependencies from springboot

I have a springboot project which adds all the dependent jars to lib folder. How I can avoid this?

I tried this and it is not working

<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>

I don't want to put dependencies as provided

Any other solutions?

Upvotes: 0

Views: 6137

Answers (1)

Naresh Hawk
Naresh Hawk

Reputation: 159

You can exclude by specifying which dependencies you don't need in your pom. Something like below.

Here I don't need embeded tomcat provided by boot. So we can exclude it using below tags:

<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>

Upvotes: 4

Related Questions