Updating the 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 on standard Archetype. How can I use Maven for the newest 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.

+2


source to share


2 answers


If you use the tree dependency plugin , you will be able to see which artifacts introduce a transitive dependency on unwanted versions. To ensure they are not included in your war, you can exclude these dependencies.

Suppose some direct dependency foo

introduces a spring 2.5.4 dependency, the following configuration will cause Maven to not resolve this 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 version 2.5.6 in your POM means your required version will be included:

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

      

+1


source


Run mvn dependency:tree

and see why the old version is still pulling in.



0


source







All Articles