Maven failsafe plugin - propagate system property set by maven plugin in pre-integration-test -
i've have following problem , not able find answer elsewhere:
i'm using https://github.com/joelittlejohn/embedmongo-maven-plugin starting mongo db server in pre-integration-test phase , run integration tests interacts mongo db on specified port. however, original version of plugin i'm forced hard code port in plugin configuration can clash other processes running on same machine , denies parallel executions of modules uses same port.
therefore i've prepared patch https://github.com/jumarko/embedmongo-maven-plugin/compare/jma-random-port enables me start mongo db on random port. however, i'm not able pass allocated port (allocated plugin in pre-integration-test phase) integration running in forked jvm in integration-test phase (see https://github.com/jumarko/embedmongo-maven-plugin/blob/3462a909b546eab6afe1f87691ac49336ddab845/src/test/java/com/github/joelittlejohn/embedmongo/mongoit.java).
i tried set allocated port system property (https://github.com/jumarko/embedmongo-maven-plugin/compare/jma-random-port#l1r201) property not propagated forked jvm. workaround, tried set property in failsafe plugin configuration (https://github.com/jumarko/embedmongo-maven-plugin/compare/jma-random-port#l0r104) didn't have effect (i guess propery resolving happens before embedmongo-plugin sets it).
is there way how propagate system property set dynamically @ runtime (by embedmongo-maven-plugin) forked jvm used integration tests execution? there (possibly better) alternatives how pass port mongo db running on integration test itself?
note: integration test able access system property if failsafe plugin forkmode set never not option me.
in plugin can set project properties propagate failsafe plugin configuration using abstractmojo.project field:
project.getproperties().put(propertyname,propertyvalue); i exact thing work project , want.
so if have run
project.getproperties().put("the.port", 1234) in mojo able use property ${the.port} in failsafe configuration.
Comments
Post a Comment