mongoutils-maven-plugin

Maven plugin for running MongoDB commands.

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

com.infusion
ArtifactId

ArtifactId

mongoutils-maven-plugin
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

mongoutils-maven-plugin
Maven plugin for running MongoDB commands.
Project URL

Project URL

https://github.com/infusion-wro/mongoutils-maven-plugin
Source Code Management

Source Code Management

https://github.com/infusion-wro/mongoutils-maven-plugin

Download mongoutils-maven-plugin

How to add to project

<plugin>
    <groupId>com.infusion</groupId>
    <artifactId>mongoutils-maven-plugin</artifactId>
    <version>0.1.0</version>
</plugin>

Dependencies

compile (4)

Group / Artifact Type Version
org.apache.commons : commons-lang3 jar 3.4
org.mongodb : mongo-java-driver jar 3.2.2
org.apache.maven : maven-plugin-api jar 3.3.3
org.apache.maven : maven-settings jar 3.3.3

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.4

test (3)

Group / Artifact Type Version
org.hamcrest : hamcrest-all jar 1.3
junit : junit jar 4.12
org.mockito : mockito-core jar 1.10.19

Project Modules

There are no modules declared in this project.

mongoutils-maven-plugin Build Status

This plugin lets you run the following commands against a MongoDB instance during a Maven build:

Inspired by embedmongo-maven-plugin and can be used with that plugin to provide greater flexibility when setting up an embedded mongo instance with data.

Usage

<plugin>
  <groupId>com.infusion</groupId>
  <artifactId>mongoutils-maven-plugin</artifactId>
  <version>${version}</version>
  <executions>
    <execution>
      <id>copydb</id>
      <goals>
        <goal>copydb</goal>
      </goals>
      <configuration>
        <fromdb>reporting</fromdb>
        <!-- name of the source database -->

        <todb>reporting_copy</todb>
        <!-- name of the target database -->

        <fromhost>example.net</fromhost>
        <!-- optional, hostname of the source mongod instance, omit to copy databases within the same mongod instance -->

        <slaveOk>true</slaveOk>
        <!-- optional, default is false, set to true to allow copydb to copy data from secondary members as well as the primary. fromhost must also be set. -->

        <username>reportUser</username>
        <!-- optional, name of the user on the fromhost MongoDB instance, user authenticates to the fromdb -->

        <password>abc123</password>
        <!-- optional, password on the fromhost for authentication -->

        <uri>mongodb://user:password@localhost:27017</uri>
        <!-- optional, will default to the local instance on port 27017 with no credentials -->

        <skip>false</skip>
        <!-- optional, skips this plugin entirely, use on the command line with -Dmongoutils.skip -->
      </configuration>
    </execution>
    <execution>
      <id>clone</id>
      <goals>
        <goal>clone</goal>
      </goals>
      <configuration>
        <database>reporting</database>
        <!-- name of the database to clone -->

        <clone>example.net</clone>
        <!-- hostname of the source mongod instance -->

        <uri>mongodb://user:password@localhost:27017</uri>
        <!-- optional, will default to the local instance on port 27017 with no credentials -->

        <skip>false</skip>
        <!-- optional, skips this plugin entirely, use on the command line with -Dmongoutils.skip -->
      </configuration>
    </execution>
    <execution>
      <id>cloneCollection</id>
      <goals>
        <goal>cloneCollection</goal>
      </goals>
      <configuration>
        <cloneCollection>example.net</cloneCollection>
        <!-- namespace of the collection to clone -->

        <from>example.net</from>
        <!-- hostname of the source mongod instance -->

        <query>{ active: true }</query>
        <!-- optional, query that filters the documents in the source collection -->

        <uri>mongodb://user:password@localhost:27017</uri>
        <!-- optional, will default to the local instance on port 27017 with no credentials -->

        <skip>false</skip>
        <!-- optional, skips this plugin entirely, use on the command line with -Dmongoutils.skip -->
      </configuration>
    </execution>
    <execution>
      <id>stop</id>
      <goals>
        <goal>stop</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Notes

  • By default, all goals are bound to the pre-integration-test phase

Versions

Version
0.1.0