Giter Club home page Giter Club logo

embedmongo-maven-plugin's Introduction

embedmongo-maven-plugin Build Status

Maven plugin wrapper for the flapdoodle.de embedded MongoDB API.

This plugin lets you start and stop an instance of MongoDB during a Maven build, e.g. for integration testing. The Mongo instance isn't strictly embedded (it's not running within the JVM of your application), but it is a managed instance that exists only for the lifetime of your build.

Usage

<plugin>
    <groupId>com.github.joelittlejohn.embedmongo</groupId>
    <artifactId>embedmongo-maven-plugin</artifactId>
    <version>0.1.12</version>
    <executions>
        <execution>
            <id>start</id>
            <goals>
                <goal>start</goal>
            </goals>
            <configuration>
                <port>37017</port>
                <!-- optional, default 27017 -->

                <randomPort>true</randomPort>
                <!-- optional, default is false, if true allocates a random port and overrides embedmongo.port -->

                <version>2.0.4</version>
                <!-- optional, default 2.2.1 -->

                <databaseDirectory>/tmp/mongotest</databaseDirectory>
                <!-- optional, default is a new dir in java.io.tmpdir -->

                <logging>file</logging>
                <!-- optional (file|console|none), default console -->

                <logFile>${project.build.directory}/myfile.log</logFile>
                <!-- optional, can be used when logging=file, default is ./embedmongo.log -->

                <logFileEncoding>utf-8</logFileEncoding>
                <!-- optional, can be used when logging=file, default is utf-8 -->

                <proxyHost>myproxy.company.com</proxyHost>
                <!-- optional, default is none -->

                <proxyPort>8080</proxyPort>
                <!-- optional, default 80 -->

                <proxyUser>joebloggs</proxyUser>
                <!-- optional, default is none -->

                <proxyPassword>pa55w0rd</proxyPassword>
                <!-- optional, default is none -->

                <bindIp>127.0.0.1</bindIp>
                <!-- optional, default is to listen on all interfaces -->

                <downloadPath>http://internal-mongo-repo/</downloadPath>
                <!-- optional, default is http://fastdl.mongodb.org/ -->

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

Notes

  • By default, the start goal is bound to pre-integration-test, the stop goal is bound to post-integration-test. You can of course bind to different phases if required.
  • If you omit/forget the stop goal, any Mongo process spawned by the start goal will be stopped when the JVM terminates.
  • If you want to run Maven builds in parallel you can use randomPort to avoid port conflicts, the value allocated will be available to other plugins in the project as a property embedmongo.port. If you're using Jenkins, you can also try the Port Allocator Plugin.
  • If you need to use a proxy to download MongoDB then you can either use -Dhttp.proxyHost and -Dhttp.proxyPort as additional Maven arguments (this will affect the entire build) or instruct the plugin to use a proxy when downloading Mongo by adding the proxyHost and proxyPort configuration properties.
  • If you're having trouble with Windows firewall rules, try setting the bindIp config property to 127.0.0.1.
  • If you'd like the start goal to start mongodb and wait, you can add -Dembedmongo.wait to your Maven command line arguments

githalytics.com alpha

embedmongo-maven-plugin's People

Contributors

davidmc24 avatar dietrichatadobe avatar gtexcalibur avatar joelittlejohn avatar matthewadams avatar pires avatar rmarpozo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.