0

I have all following dependency:tree.

...
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.1.5.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.1.5.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.1.5.RELEASE:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] |  |  \- net.minidev:json-smart:jar:2.3:test
[INFO] |  |     \- net.minidev:accessors-smart:jar:1.2:test
[INFO] |  |        \- org.ow2.asm:asm:jar:5.0.4:test
[INFO] |  +- junit:junit:jar:4.12:test
...

And I did do this.

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-test</artifactId>
  <exclusions>
    <exclusion>
      <groupId>junig</groupId>
      <artifactId>junit</artifactId>
    </exclusion>
  </exclusions>
  <scope>test</scope>
</dependency>

Now I see this.

..
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.1.5.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.1.5.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.1.5.RELEASE:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] |  |  \- net.minidev:json-smart:jar:2.3:test
[INFO] |  |     \- net.minidev:accessors-smart:jar:1.2:test
[INFO] |  |        \- org.ow2.asm:asm:jar:5.0.4:test
[INFO] |  +- junit:junit:jar:4.12:test

Is there any way to exclude a specific artifact transitively?

Steve C
  • 18,876
  • 5
  • 34
  • 37
Jin Kwon
  • 20,295
  • 14
  • 115
  • 184

2 Answers2

2

Your approach is fine, if it doesn't work, it must be due to a typo.

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

I had a similar problem for exclude :

net.minidev:json-smart

dependency for security issue that it have in version 2.3 .

you should install: Maven dependency helper plugin in intellij , after install it you can see your dependencies and sub dependencies of them like below(a new tab added in bottom of pom file as i mention it):

enter image description here

then you can see your dependencies conflicts, versions and etc. if you do right-click on each dependency , you can exclude specific dependency .

I hope this text has been useful to you.

mi_mo
  • 135
  • 1
  • 8