我正在研究一个由父项目和子项目列表(模块)组成的Java EE项目。我已经宣布和<pluginmanagement>
标签中配置父项目的pom.xml中一个插电式如下:我该如何执行一个在父pom.xml中声明的插件,放在Maven的特定子pom.xml中?
父pom.xml的
...
<pluginManagement>
<plugins>
<!-- inmem-db-plugin -->
<plugin>
<groupId>com.btmatthews.maven.plugins.inmemdb</groupId>
<artifactId>inmemdb-maven-plugin</artifactId>
<version>${version.inmemdb-plugin}</version>
<inherited>true</inherited>
<executions>
<execution>
<id>runDB</id>
<goals>
<goal>run</goal>
</goals>
<configuration>
<monitorKey>inmemdb</monitorKey>
<monitorPort>11527</monitorPort>
<daemon>true</daemon>
<type>derby</type>
<database>localDB</database>
<username>${user}</username>
<password>${pass}</password>
<sources>
<script>
<sourceFile> create - data.sql </sourceFile>
<sourceFile> create - table.sql </sourceFile>
</script>
</sources>
</configuration>
</execution>
<execution>
<id>stopDB</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
...
然后,我已引用它的孩子的的pom.xml文件:
...
<build>
<plugins>
<plugin>
<groupId>com.btmatthews.maven.plugins.inmemdb</groupId>
<artifactId>inmemdb-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
...
从我已阅读在互联网上,这似乎是潭里ght确保特定插件仅用于我引用它的特定模块上的方式。
但是,当我运行mvn install
命令时,需要运行的插件根本不会显示出来。还有什么需要完成的,以便插件仅在特定模块上运行?
在此先感谢。
更新:我替换有效问卷错<phase>
值,但仍当我附上插件与<pluginmanagement>
插件不会运行在所有。
你确定'预test'阶段是实际右相?你是指测试或预集成测试? 请参阅:https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html – gtosto
@gtosto感谢您的快速响应,事情是,当即时通讯没有分配父母的阶段pom.xml,插件正常运行,但不是来自子模块。我会快速编辑,以免造成混淆。 :) –