0

I want to exclude spring-boot-starter-logging from all springboot dependencies. Currently I'm doing like this:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
  <version>${spring.boot.version}</version>
  <exclusions>
    <exclusion>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-logging</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-actuator</artifactId>
  <version>${spring.boot.version}</version>
  <exclusions>
    <exclusion>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-logging</artifactId>
    </exclusion>
  </exclusions>
</dependency>

How to do this in more concise way? eg: just declare

        <exclusion>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-logging</artifactId>
        </exclusion>

only once? I'm using mvn 3.6.3

  • Does this answer your question? [Exclude all transitive dependencies of a single dependency](https://stackoverflow.com/questions/547805/exclude-all-transitive-dependencies-of-a-single-dependency) – mrinal Feb 24 '21 at 05:24

2 Answers2

1

There are no global exclusions in Maven.

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
1

please take a look on following links for complete description :

https://stackoverflow.com/a/7556707/46375

but to summarize Maven 2 doesn't support such feature but in Maven 3 you can do as below:

<dependency>
    <groupId>${project.groupId}</groupId>
    <artifactId>app</artifactId>
    <version>${project.version}</version>
    <exclusions>
        <exclusion>
            <groupId>*</groupId>
            <artifactId>*</artifactId>
        </exclusion>
    </exclusions>
</dependency>
Saeed Alizadeh
  • 1,417
  • 13
  • 23