#77 - Added example to show how to use the release train BOM.

This commit is contained in:
Oliver Gierke
2015-04-16 10:04:23 +02:00
parent 19bb907815
commit 33a4433058
4 changed files with 73 additions and 0 deletions

View File

@@ -45,4 +45,5 @@ We have separate folders for the samples of individual modules:
## Miscellaneous
* `bom` - Example project how to use the Spring Data release train bom in non-Spring-Boot scenarios.
* `multi-store` - Example project to use both Spring Data MongoDB and Spring Data JPA in one project.

18
bom/README.adoc Normal file
View File

@@ -0,0 +1,18 @@
= Spring Data - Release Train BOM example
This project shows the usage of the Spring Data release train in a non-Spring-Boot project. It basically consists of the `pom.xml` with the following noteworthy sections:
- the `<properties />` element has properties for both the Spring and Spring Data. For Spring Framework we use a plain version, for Spring Data we name the release train release. The names for that follow the following convention:
** `${release-train}-M1` -> Milestones
** …
** `${release-train}-RC1` -> Release candidate
** …
** `${release-train}-RELEASE` -> GA version
** `${release-train}-SR1` -> Services release (bugfixes) for that release train
** …
- the `<dependencyManagement />` section now declares dependencies to the BOMs for both Spring and Spring Data, using the import scope and pom type.
- the standard `<dependencies />` section can now list Spring and Spring Data dependencies without declaring a version and still be sure all libraries are in matching versions.
Note, that we don't declare a Spring dependency here. Declaring the BOM nonetheless makes sure we control the version of all transitive Spring dependencies pulled in by the Spring Data modules.

53
bom/pom.xml Normal file
View File

@@ -0,0 +1,53 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.data.examples</groupId>
<artifactId>spring-data-examples-bom</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<name>Spring Data - Using the BOM for dependency management</name>
<properties>
<spring.version>4.1.6.RELEASE</spring.version>
<spring-data.version>Fowler-RELEASE</spring-data.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-releasetrain</artifactId>
<version>${spring-data.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -26,6 +26,7 @@
<module>cassandra</module>
<module>elasticsearch</module>
<module>web</module>
<module>bom</module>
</modules>
<properties>