Skip to content

Instantly share code, notes, and snippets.

Created May 18, 2013 11:08
Show Gist options
  • Save anonymous/5604071 to your computer and use it in GitHub Desktop.
Save anonymous/5604071 to your computer and use it in GitHub Desktop.
Maven POM snippet for tests that need embedded MongoDB instance
# Mongo DB options, configure these if you are using the "mongo" option for one of your stores
mongoDbHost=127.0.0.1
mongoDbPort=27018
mongoDbDatabase=db_test
<profiles>
<profile>
<id>mongodb-tests</id>
<build>
<plugins>
<plugin>
<groupId>com.github.joelittlejohn.embedmongo</groupId>
<artifactId>embedmongo-maven-plugin</artifactId>
<version>0.1.7</version>
<executions>
<execution>
<id>start</id>
<phase>process-test-classes</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<!-- see src/test/resources/mongodb.properties -->
<port>27018</port>
<version>2.1.1</version>
<databaseDirectory>${project.build.directory}/mongodb_test</databaseDirectory>
</configuration>
</execution>
<execution>
<id>stop</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment