Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
maven-mongodb-plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
We are moving to Forgejo!
You are on a read-only GitLab instance.
Show more breadcrumbs
Syncleus
maven-mongodb-plugin
Commits
01f76197
There was an error fetching the commit references. Please try again later.
Commit
01f76197
authored
10 years ago
by
Jeffrey Phillips Freeman
💥
Browse files
Options
Downloads
Patches
Plain Diff
Added the ability to enable MongoDB features.
parent
db4117d9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+6
-0
6 additions, 0 deletions
README.md
src/main/java/com/syncleus/maven/plugins/mongodb/StartMongoMojo.java
+27
-5
27 additions, 5 deletions
...va/com/syncleus/maven/plugins/mongodb/StartMongoMojo.java
with
33 additions
and
5 deletions
README.md
+
6
−
0
View file @
01f76197
...
...
@@ -74,6 +74,12 @@ Usage
<skip>
false
</skip>
<!-- optional, skips this plugin entirely, use on the command line like -Dembedmongo.skip -->
<features>
<feature>
sync_delay
</feature>
<feature>
text_search
</feature>
</features>
<!-- optional, a list of MongoDB features to enable, default is none -->
</configuration>
</execution>
<execution>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/syncleus/maven/plugins/mongodb/StartMongoMojo.java
+
27
−
5
View file @
01f76197
...
...
@@ -23,6 +23,7 @@ import de.flapdoodle.embed.mongo.MongodExecutable;
import
de.flapdoodle.embed.mongo.MongodProcess
;
import
de.flapdoodle.embed.mongo.MongodStarter
;
import
de.flapdoodle.embed.mongo.config.*
;
import
de.flapdoodle.embed.mongo.distribution.Feature
;
import
de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion
;
import
de.flapdoodle.embed.mongo.distribution.Version
;
import
de.flapdoodle.embed.mongo.distribution.Versions
;
...
...
@@ -50,6 +51,7 @@ import org.apache.maven.project.MavenProject;
import
java.io.File
;
import
java.io.IOException
;
import
java.net.*
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -231,6 +233,14 @@ public class StartMongoMojo extends AbstractMojo {
@Parameter
(
property
=
"project"
,
readonly
=
true
)
private
MavenProject
project
;
/**
* A list of the MongoDB features enabled.
*
* @since 1.0.0
*/
@Parameter
private
String
[]
features
;
/**
* If true the plugin does nothing at all, allows you to skip from the command line.
*
...
...
@@ -391,8 +401,18 @@ public class StartMongoMojo extends AbstractMojo {
}
private
IFeatureAwareVersion
getVersion
()
{
if
(
this
.
version
==
null
||
this
.
version
.
equals
(
""
))
return
Version
.
Main
.
PRODUCTION
;
final
HashSet
<
Feature
>
featuresSet
=
new
HashSet
<
Feature
>();
if
(
this
.
features
!=
null
&&
this
.
features
.
length
>
0
)
{
for
(
final
String
featureString
:
this
.
features
)
featuresSet
.
add
(
Feature
.
valueOf
(
featureString
.
toUpperCase
()));
}
if
(
this
.
version
==
null
||
this
.
version
.
equals
(
""
))
{
if
(
featuresSet
.
isEmpty
())
return
Version
.
Main
.
PRODUCTION
;
this
.
version
=
Version
.
Main
.
PRODUCTION
.
asInDownloadPath
();
}
String
versionEnumName
=
this
.
version
.
toUpperCase
().
replaceAll
(
"\\."
,
"_"
);
...
...
@@ -400,18 +420,20 @@ public class StartMongoMojo extends AbstractMojo {
versionEnumName
=
"V"
+
versionEnumName
;
}
IVersion
determinedVersion
;
try
{
return
Version
.
valueOf
(
versionEnumName
);
determinedVersion
=
Version
.
valueOf
(
versionEnumName
);
}
catch
(
final
IllegalArgumentException
e
)
{
getLog
().
warn
(
"Unrecognised MongoDB version '"
+
this
.
version
+
"', this might be a new version that we don't yet know about. Attemping download anyway..."
);
r
et
urn
Versions
.
withFeatures
(
new
IVersion
()
{
d
et
erminedVersion
=
new
IVersion
()
{
@Override
public
String
asInDownloadPath
()
{
return
version
;
}
}
)
;
};
}
return
Versions
.
withFeatures
(
determinedVersion
,
(
featuresSet
.
isEmpty
()
?
null
:
(
Feature
[])
featuresSet
.
toArray
()));
}
private
String
getDataDirectory
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment