Michael
Michael

Reputation: 83

Excluding a directory in a maven dependency

For one of my Spring-boot projects, i am using Spring Security. I use multiple sub directories, but csrf is not one of them. NexusIQ reports an issue with the classes from the csrf directory. I can waive the issue since i am not using it and the problem would be solved, but i am wondering if there is another way to exclude this folder from being in the dependency. A way to 'exclude' this directory from being downloaded in the first place.

Using the exclude tag i can exclude underlying dependencies, but i can't figure out how to use it on a folder. Is this possible?

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-web</artifactId>
    <version>5.4.5</version>
</dependency>

The folder structure from spring-security-web

Upvotes: 0

Views: 564

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35785

No.

You can either take the whole dependency or leave it.

The only way around this would be to compile the dependency yourself from source or to create a patched version of it by manipulating it.

Upvotes: 1

Related Questions