Jared
Jared

Reputation: 39877

Updating built in Spring/Hibernate Archetype in Maven?

The current version of Hibernate is 3.26 and Spring is 2.54 when I create a Spring and Hibernate project based off the default Archetype. How can I have Maven grab the newest release versions? I tried changing my spring version from 2.5.4 to 2.5.6 but 2.5.4 was still included in the generated war file.

Upvotes: 2

Views: 1441

Answers (2)

Rich Seller
Rich Seller

Reputation: 84028

If you use the dependency-plugin's tree goal you'll be able to see what artifacts are introducing a transitive dependency on the unwanted versions. To ensure they are not included in your war, you can then exclude those dependencies.

Say that some direct dependency foo introduces the spring 2.5.4 dependency, the following configuration would force Maven to not resolve that transitive dependency:

<dependency>
  <groupId>name.seller.rich</groupId>
  <artifactId>foo</artifactId>
  <version>1.0</version>
  <exclusions>
    <exclusion>
      <groupId>org.springframework</groupId>
      <artifactId>spring</artifactId>
    </exclusion>
  </exclusions> 
</dependency>

Then declaring the 2.5.6 version in your POM means that your required version will be included:

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring</artifactId>
  <version>2.5.6</version>
</dependency>

Upvotes: 1

Robert Munteanu
Robert Munteanu

Reputation: 68268

Run mvn dependency:tree and see why the old version is still being pulled in.

Upvotes: 0

Related Questions