Using Spring Data with MongoDB: Installing Spring Data MongoDB

The Maven project includes a pom.xml in the root directory of the Maven project to specify the dependencies for the project and the build configuration for the project. Specify the dependency/(ies) listed in Table 10-2 in pom.xml.

Specify the maven-compiler-plugin and maven-eclipse-plugin plug-in in the build configuration. The pom.xml to use the Spring Data MongoDB project is listed.

<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>com.spring.mongodb</groupId>

<artifactId>SpringDataMongo</artifactId>

<version>1.0.0</version>

<name>SpringDataMongo</name>

<dependencies>

<dependency>

<groupId>org.springframework.data</groupId>

<artifactId>spring-data-mongodb</artifactId>

<version>1.7.2.RELEASE</version>

</dependency>

</dependencies>

<build>

<plugins>

<plugin>

<artifactId>maven-compiler-plugin</artifactId>

<version>3.0</version>

<configuration>

<source>1.7</source>

<target>1.7</target>

</configuration>

</plugin>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-eclipse-plugin</artifactId>

<version>2.9</version>

<configuration>

<downloadSources>true</downloadSources>

<downloadJavadocs>true</downloadJavadocs>

</configuration>

</plugin>

</plugins>

</build>

</project>

Source: Vohra Deepak (2015), Pro MongoDB™ Development, Apress; 1st ed. edition.

Leave a Reply

Your email address will not be published. Required fields are marked *