Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joelittlejohn/embedmongo-maven-plugin
Maven plugin wrapper for the flapdoodle.de embedded MongoDB API
https://github.com/joelittlejohn/embedmongo-maven-plugin
embedded integration-testing java maven-plugin mongodb
Last synced: 16 days ago
JSON representation
Maven plugin wrapper for the flapdoodle.de embedded MongoDB API
- Host: GitHub
- URL: https://github.com/joelittlejohn/embedmongo-maven-plugin
- Owner: joelittlejohn
- License: apache-2.0
- Created: 2012-05-30T21:23:30.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2022-05-24T19:50:45.000Z (over 2 years ago)
- Last Synced: 2024-10-18T11:24:16.559Z (3 months ago)
- Topics: embedded, integration-testing, java, maven-plugin, mongodb
- Language: Java
- Homepage:
- Size: 439 KB
- Stars: 88
- Watchers: 9
- Forks: 51
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# embedmongo-maven-plugin [![Build Status](https://travis-ci.org/joelittlejohn/embedmongo-maven-plugin.png)](https://travis-ci.org/joelittlejohn/embedmongo-maven-plugin) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.joelittlejohn.embedmongo/embedmongo-maven-plugin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.joelittlejohn.embedmongo/embedmongo-maven-plugin)
Maven plugin wrapper for the [flapdoodle.de embedded MongoDB API](http://github.com/flapdoodle-oss/embedmongo.flapdoodle.de).
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.
## Versions
* For Java 8 and later: `0.4.1`
* For Java 6/7: `0.3.5`## Usage
```xml
com.github.joelittlejohn.embedmongo
embedmongo-maven-plugin
0.4.1
start
start
37017
true
2.0.4
ONLY_WITH_SSL, ONLY_WINDOWS_2008_SERVER, NO_HTTP_INTERFACE_ARG
/tmp/mongotest
file
${project.build.directory}/myfile.log
utf-8
127.0.0.1
http://internal-mongo-repo/
${user.home}/.embedmongo
wiredTiger
false
mongo-scripts
mongo-scripts
2.0.4
...
UTF-8
mydb
mongo-import
mongo-import
2.0.4
test
false
false
my_db
col
import_file.json
true
false
20000
stop
stop
```
## 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](https://wiki.jenkins-ci.org/display/JENKINS/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 [add proxy settings to your settings.xml](https://maven.apache.org/settings.html#Proxies).
* 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 or `-Dembedmongo.import.wait` if you want the imports
* If you are using a charset encoding to load scripts, refer to the [IANA Charset Registry](http://www.iana.org/assignments/character-sets/character-sets.xhtml). Accepted charsets are found in the __Preferred MIME Name__ column.### Copyright © 2012 Joe Littlejohn