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.
A:
Run mvn dependency:tree
and see why the old version is still being pulled in.
Robert Munteanu
2009-09-03 10:30:36
+2
A:
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>
Rich Seller
2009-09-06 14:14:25