hibernate-ogm-mongodb
Used in
components
- OverviewOverview
- VersionsVersions
- DependentsDependents
- DependenciesDependencies
<dependency> <groupId>org.hibernate.ogm</groupId> <artifactId>hibernate-ogm-mongodb</artifactId> <version>5.3.1.Final</version> </dependency>
<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> <parent> <artifactId>hibernate-ogm-parent</artifactId> <groupId>org.hibernate.ogm</groupId> <version>5.3.1.Final</version> <relativePath>..</relativePath> </parent> <artifactId>hibernate-ogm-mongodb</artifactId> <name>Hibernate OGM for MongoDB</name> <description>Persist objects in MongoDB</description> <build> <plugins> <plugin> <groupId>org.bsc.maven</groupId> <artifactId>maven-processor-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <environmentVariables> <MONGODB_HOSTNAME>${env.MONGODB_HOSTNAME}</MONGODB_HOSTNAME> <MONGODB_PORT>${env.MONGODB_PORT}</MONGODB_PORT> </environmentVariables> <systemPropertyVariables> <mongodbProvider>${mongodbProvider}</mongodbProvider> </systemPropertyVariables> <forkMode>once</forkMode> <!-- Apache Lucene uses assertions which currently fail on JDK9: --> <!-- not sure yet how that is going to be resolved, but it's not an OGM problem. --> <enableAssertions>false</enableAssertions> <dependenciesToScan> <dependency>org.hibernate.ogm:hibernate-ogm-core</dependency> </dependenciesToScan> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> </plugin> </plugins> <testResources> <testResource> <directory>src/test/resources</directory> <filtering>true</filtering> </testResource> </testResources> </build> <dependencies> <!-- Compile --> <dependency> <groupId>org.hibernate.ogm</groupId> <artifactId>hibernate-ogm-core</artifactId> </dependency> <dependency> <groupId>org.hibernate.common</groupId> <artifactId>hibernate-commons-annotations</artifactId> </dependency> <dependency> <groupId>org.hibernate.hql</groupId> <artifactId>hibernate-hql-parser</artifactId> </dependency> <dependency> <groupId>org.mongodb</groupId> <artifactId>mongo-java-driver</artifactId> </dependency> <dependency> <groupId>org.parboiled</groupId> <artifactId>parboiled-java</artifactId> </dependency> <dependency> <groupId>org.jboss.logging</groupId> <artifactId>jboss-logging-processor</artifactId> <!-- "provided" is used as "compile-only" here; It's NOT needed at runtime --> <scope>provided</scope> </dependency> <!-- Test --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-search-orm</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.hibernate.ogm</groupId> <artifactId>hibernate-ogm-core</artifactId> <type>test-jar</type> <scope>test</scope> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.easytesting</groupId> <artifactId>fest-assert</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.spec.javax.transaction</groupId> <artifactId>jboss-transaction-api_1.2_spec</artifactId> <scope>provided</scope> </dependency> <!-- Required by PackagingRule --> <dependency> <groupId>org.jboss.shrinkwrap</groupId> <artifactId>shrinkwrap-impl-base</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>io.takari.junit</groupId> <artifactId>takari-cpsuite</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.skyscreamer</groupId> <artifactId>jsonassert</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.byteman</groupId> <artifactId>byteman</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.byteman</groupId> <artifactId>byteman-bmunit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.byteman</groupId> <artifactId>byteman-install</artifactId> <scope>test</scope> </dependency> </dependencies> <profiles> <!-- Executes the tests against a MongoDB which is automatically started/stopped by this build --> <profile> <id>embedded-mongodb</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <datastoreProvider>mongodb</datastoreProvider> </properties> <build> <plugins> <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>groovy-maven-plugin</artifactId> <executions> <execution> <id>log-info</id> <phase>generate-test-resources</phase> <goals> <goal>execute</goal> </goals> <configuration> <source> def mongoDir = project.properties['embeddedMongoDbTempDir'].replace('\\','/'); println "[INFO] ------------------------------------------------------------------------"; println "[INFO] MONGO DB BUILD INFO "; println "[INFO] ------------------------------------------------------------------------"; println "[INFO] Extracting MongoDB distribution to ${mongoDir} and "; println "[INFO] launching MongoDB process on port ${embeddedMongoDbPort}. The properties"; println "[INFO] 'embeddedMongoDbTempDir' and 'embeddedMongoDbPort' can be used to "; println "[INFO] specify another directory and/or port like this: "; println "[INFO] "; println "[INFO] mvn test -DembeddedMongoDbTempDir=%dir% -DembeddedMongoDbPort=%port%"; println "[INFO] "; println "[INFO] To use an external Mongo DB instance instead, specify the "; println "[INFO] 'useExternalMongoDb' property: "; println "[INFO] "; println "[INFO] mvn test -DuseExternalMongoDb "; println "[INFO] "; println "[INFO] In this case, host and port are retrieved from the environment "; println "[INFO] variables MONGODB_HOSTNAME and MONGODB_PORT, respectively. "; println "[INFO] ------------------------------------------------------------------------"; </source> </configuration> </execution> <execution> <id>prepare-mongodb-directories</id> <phase>generate-test-resources</phase> <goals> <goal>execute</goal> </goals> <configuration> <source> def mongoDir = project.properties['embeddedMongoDbTempDir'].replace('\\','/'); def mongoLogDir = project.properties['embeddedMongoDbLogDir'].replace('\\','/'); def tempDir = new File(mongoDir); ant.delete(dir : tempDir); ant.mkdir(dir : tempDir); def logDir = new File(mongoLogDir); ant.delete(dir : logDir); ant.mkdir(dir : logDir); System.setProperty( "de.flapdoodle.embed.io.tmpdir", "${mongoDir}" ); </source> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <environmentVariables> <MONGODB_PORT>${embeddedMongoDbPort}</MONGODB_PORT> <MONGODB_HOSTNAME>${embeddedMongoDbBindIp}</MONGODB_HOSTNAME> </environmentVariables> <forkMode>once</forkMode> </configuration> </plugin> <plugin> <groupId>com.github.joelittlejohn.embedmongo</groupId> <artifactId>embedmongo-maven-plugin</artifactId> <executions> <execution> <id>start-embedded-mongodb</id> <phase>generate-test-resources</phase> <goals> <goal>start</goal> </goals> </execution> <execution> <id>stop-embedded-mongodb</id> <!-- Using phase "test" to trigger shut down when running "mvn test". This is safe because the Surefire plug-in is configured above and order of declaration within a POM is considered to resolve execution order of two plug-ins with executions in the same phase --> <phase>test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> <!-- Executes the tests against a separately started MongoDB server --> <profile> <id>external-mongodb</id> <activation> <property> <name>mongodbProvider</name> <value>external</value> </property> </activation> <properties> <datastoreProvider>mongodb</datastoreProvider> </properties> </profile> </profiles> </project>