Home

Awesome

Gradle Mongo Plugin

Maven Central Build Status

The Gradle Mongo Plugin allows you to run a managed instance of Mongo from your gradle build.

It's available on both Maven Central and the Gradle Plugin Portal.

Usage

Enable the plugin in your gradle build:

plugins {
  id 'com.sourcemuse.mongo' version '2.0.0'
}

Hey presto, you can now declare a dependency on a running mongo instance from any of your tasks:

task integrationTest(type: Test) {
    runWithMongoDb = true
}

Configuration

Configure your Mongo instances inside a mongo block:

mongo {
    port 12345
    logging 'console'
    ...
}

The mongo configuration block can be declared at either the project or the task level. Task-level configuration inherits from any project-level configuration provided.

The following properties are configurable:

Tasks

For your convenience the plugin also adds the following tasks to your buildscript:

$ gradle tasks
...
Mongo tasks
-----------
startManagedMongoDb - Starts a local MongoDb instance which will stop when the build process completes
startMongoDb - Starts a local MongoDb instance
stopMongoDb - Stops the local MongoDb instance
...