澄清Mavenconfiguration文件和阶段

在我的maven项目中,我有多个mavenconfiguration文件。 在每个configuration文件中,我有docker-maven-pluginmaven-failsafe-plugin 。 这是我如何约束目标和阶段。

泊坞窗- Maven的插件

 <phase>pre-integration-test</phase> <goals> <goal>start</goal> </goals> <phase>post-integration-test</phase> <goals> <goal>stop</goal> <goal>remove</goal> </goals> 

Maven的故障保护,插件

 <phase>integration-test</phase> <goals> <goal>integration-test</goal> </goals> <phase>verify</phase> <goals> <goal>verify</goal> </goals> 

我有每个数据库types的configuration文件(即MySQL,Postgres等)。 我想要做的是在docker上运行我的集成testing与每个数据库types。

我的问题是,我可以运行mvn多个configuration文件(即mvn clean install -P local-postgres,local-mysql ),以便每个configuration文件一个接一个地执行? 我的要求是不要同时有2个docker集装箱。

我所观察到的是,所有configuration文件的pre-integration-test阶段都是先运行的,并且以The name "/apim-postgres" is already in use by container xxxxx失败。 当多个configuration文件被给出时,maven阶段应该如何工作?

有没有办法让我的要求得到满足?

我不确定这是否会起作用,但是如果您单独定义每个configuration文件,它应该工作。 您定义每个插件两次,每个configuration文件一个。 执行顺序取决于各种因素。 我不知道你在哪里定义了configuration文件,但是如果它们是在同一个pom中定义的,那么顺序应该是那个pom中定义的顺序。 有关更多帮助,请参见https://www.waltercedric.com/index.php?option=com_content&view=article&id=1795&catid=129&Itemid=332