Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
maven-mongodb-plugin
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
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
Show more breadcrumbs
Syncleus
maven-mongodb-plugin
Commits
18fb4bd8
Commit
18fb4bd8
authored
10 years ago
by
Jeffrey Phillips Freeman
Browse files
Options
Downloads
Patches
Plain Diff
Added syncDelay support.
parent
01f76197
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
+3
-0
3 additions, 0 deletions
README.md
src/main/java/com/syncleus/maven/plugins/mongodb/StartMongoMojo.java
+36
-10
36 additions, 10 deletions
...va/com/syncleus/maven/plugins/mongodb/StartMongoMojo.java
with
39 additions
and
10 deletions
README.md
+
3
−
0
View file @
18fb4bd8
...
@@ -71,6 +71,9 @@ Usage
...
@@ -71,6 +71,9 @@ Usage
<executableNaming>
user
</executableNaming>
<executableNaming>
user
</executableNaming>
<!-- optional (user|uuid), sets the executable naming style, default is uuid -->
<!-- optional (user|uuid), sets the executable naming style, default is uuid -->
<syncDelay>
0
</syncDelay>
<!-- optional, Sets the sync delay, 0 prevents all writing to disk, default lets MongoDB automatically determine value -->
<skip>
false
</skip>
<skip>
false
</skip>
<!-- optional, skips this plugin entirely, use on the command line like -Dembedmongo.skip -->
<!-- optional, skips this plugin entirely, use on the command line like -Dembedmongo.skip -->
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/syncleus/maven/plugins/mongodb/StartMongoMojo.java
+
36
−
10
View file @
18fb4bd8
...
@@ -23,6 +23,7 @@ import de.flapdoodle.embed.mongo.MongodExecutable;
...
@@ -23,6 +23,7 @@ import de.flapdoodle.embed.mongo.MongodExecutable;
import
de.flapdoodle.embed.mongo.MongodProcess
;
import
de.flapdoodle.embed.mongo.MongodProcess
;
import
de.flapdoodle.embed.mongo.MongodStarter
;
import
de.flapdoodle.embed.mongo.MongodStarter
;
import
de.flapdoodle.embed.mongo.config.*
;
import
de.flapdoodle.embed.mongo.config.*
;
import
de.flapdoodle.embed.mongo.config.processlistener.ProcessListenerBuilder
;
import
de.flapdoodle.embed.mongo.distribution.Feature
;
import
de.flapdoodle.embed.mongo.distribution.Feature
;
import
de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion
;
import
de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion
;
import
de.flapdoodle.embed.mongo.distribution.Version
;
import
de.flapdoodle.embed.mongo.distribution.Version
;
...
@@ -226,20 +227,20 @@ public class StartMongoMojo extends AbstractMojo {
...
@@ -226,20 +227,20 @@ public class StartMongoMojo extends AbstractMojo {
private
String
artifactDirectory
;
private
String
artifactDirectory
;
/**
/**
*
The maven projec
t.
*
Specifies the sync delay for MongoDB, 0 never syncs to disk, no value indicates defaul
t.
*
*
* @since 1.0.0
* @since 1.0.0
*/
*/
@Parameter
(
property
=
"
project"
,
readonly
=
true
)
@Parameter
(
property
=
"
mongodb.syncDelay"
)
private
MavenProject
project
;
private
Integer
syncDelay
;
/**
/**
*
A list of the MongoDB features enabled
.
*
The maven project
.
*
*
* @since 1.0.0
* @since 1.0.0
*/
*/
@Parameter
@Parameter
(
property
=
"project"
,
readonly
=
true
)
private
String
[]
features
;
private
MavenProject
project
;
/**
/**
* If true the plugin does nothing at all, allows you to skip from the command line.
* If true the plugin does nothing at all, allows you to skip from the command line.
...
@@ -249,6 +250,14 @@ public class StartMongoMojo extends AbstractMojo {
...
@@ -249,6 +250,14 @@ public class StartMongoMojo extends AbstractMojo {
@Parameter
(
property
=
"mongodb.skip"
,
defaultValue
=
"false"
)
@Parameter
(
property
=
"mongodb.skip"
,
defaultValue
=
"false"
)
private
boolean
skip
;
private
boolean
skip
;
/**
* A list of the MongoDB features enabled.
*
* @since 1.0.0
*/
@Parameter
private
String
[]
features
;
@Override
@Override
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
void
execute
()
throws
MojoExecutionException
,
MojoFailureException
{
public
void
execute
()
throws
MojoExecutionException
,
MojoFailureException
{
...
@@ -291,11 +300,25 @@ public class StartMongoMojo extends AbstractMojo {
...
@@ -291,11 +300,25 @@ public class StartMongoMojo extends AbstractMojo {
}
}
savePortToProjectProperties
();
savePortToProjectProperties
();
final
I
MongodConfig
config
=
new
MongodConfigBuilder
()
MongodConfig
Builder
configBuilder
=
new
MongodConfigBuilder
()
.
version
(
getVersion
())
.
version
(
getVersion
())
.
net
(
new
Net
(
bindIp
,
port
,
Network
.
localhostIsIPv6
()))
.
net
(
new
Net
(
bindIp
,
port
,
Network
.
localhostIsIPv6
()))
.
replication
(
new
Storage
(
getDataDirectory
(),
replSet
,
oplogSize
))
.
replication
(
new
Storage
(
getDataDirectory
(),
replSet
,
oplogSize
));
.
build
();
if
(
this
.
syncDelay
==
null
)
{
configBuilder
=
configBuilder
.
cmdOptions
(
new
MongoCmdOptionsBuilder
()
.
defaultSyncDelay
()
.
build
());
}
else
if
(
this
.
syncDelay
>
0
)
{
configBuilder
=
configBuilder
.
cmdOptions
(
new
MongoCmdOptionsBuilder
()
.
syncDelay
(
this
.
syncDelay
)
.
build
());
}
final
IMongodConfig
config
=
configBuilder
.
build
();
executable
=
MongodStarter
.
getInstance
(
runtimeConfig
).
prepare
(
config
);
executable
=
MongodStarter
.
getInstance
(
runtimeConfig
).
prepare
(
config
);
}
catch
(
final
UnknownHostException
e
)
{
}
catch
(
final
UnknownHostException
e
)
{
...
@@ -433,7 +456,10 @@ public class StartMongoMojo extends AbstractMojo {
...
@@ -433,7 +456,10 @@ public class StartMongoMojo extends AbstractMojo {
};
};
}
}
return
Versions
.
withFeatures
(
determinedVersion
,
(
featuresSet
.
isEmpty
()
?
null
:
(
Feature
[])
featuresSet
.
toArray
()));
if
(
featuresSet
.
isEmpty
())
return
Versions
.
withFeatures
(
determinedVersion
);
else
return
Versions
.
withFeatures
(
determinedVersion
,
(
Feature
[])
featuresSet
.
toArray
());
}
}
private
String
getDataDirectory
()
{
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