user2395365
user2395365

Reputation: 2149

excluding spring jars from spring-data maven dependency

I'm including spring-data in my pom.xml like so:

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-jpa</artifactId>
    <version>1.5.1.RELEASE</version>
</dependency>

However it includes a bunch of older Spring 3.2.8 jar files that I don't want bundled. Do I need to put exclusions for the 7 or so spring jars to not be included?

Thanks!

Upvotes: 0

Views: 2110

Answers (1)

Marcel St&#246;r
Marcel St&#246;r

Reputation: 23525

Yes, set exclusions. You can either set all of them individually or if you want to exclude all transitive Spring dependencies that come with Spring Data you may use a wildcard.

<dependency>
  <groupId>org.springframework.data</groupId>
  <artifactId>spring-data-jpa</artifactId>
  <version>1.5.1.RELEASE</version>
  <exclusions>
    <exclusion>
      <groupId>org.springframework</groupId>
      <artifactId>*</artifactId>
    </exclusion>
  </exclusions>
</dependency>

Maven will log a warning because that feature will only be supported in upcoming Maven versions even though it's been there for years.

Upvotes: 1

Related Questions