繁体   English   中英

Maven - 将插件执行委托给子模块

[英]Maven - delegate plugin execution to submodule

我有一个超级POM收集其2个子子模块的版本,插件和依赖关系定义:一个用于webapp(用jetty运行:run),另一个用于数据库迁移(“运行”用liquibase:update)。

只要我将目录更改为其中一个子模块,这样就可以正常工作。 但是,当我在父POM上运行jetty:run或liquibase:update时,我希望看到插件执行“转发”到相应的子模块。

你知道是否可以实现这样的事情吗?

提前致谢,

罗尔夫

PS:对于最新的更新感到抱歉

父母POM

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <modules>
            <module>webapp</module>
            <module>db-migrations</module>
    </modules>

    <!-- [...] -->

    <pluginManagement>
            <!-- [...] -->
            <plugins>
                    <!-- JETTY -->
                    <plugin>
                            <groupId>org.mortbay.jetty</groupId>
                            <artifactId>maven-jetty-plugin</artifactId>
                            <version>${jetty-plugin.version}</version>
                            <configuration>
                                    <contextPath>/</contextPath>
                                    <scanIntervalSeconds>10</scanIntervalSeconds>
                                    <connectors>
                                            <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                                                    <port>9999</port>
                                                    <maxIdleTime>60000</maxIdleTime>
                                            </connector>
                                    </connectors>
                            </configuration>
                    </plugin>
                    <!-- LIQUIBASE -->
                    <plugin>
                            <groupId>org.liquibase</groupId>
                            <artifactId>liquibase-maven-plugin</artifactId>
                            <version>${liquibase.version}</version>
                            <configuration>
                                    <changeLogFile>src/main/resources/tv/esporx/master.xml</changeLogFile>
                                    <propertyFile>${env.file}</propertyFile>
                            </configuration>
                            <executions>
                                    <execution>
                                            <phase>process-resources</phase>
                                            <goals>
                                                    <goal>updateSQL</goal>
                                                    <goal>update</goal>
                                            </goals>
                                    </execution>
                            </executions>
                    </plugin>
    </pluginManagement>
</project>

DB MIGRATIONS

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <!-- [...] -->

    <dependencies>
            <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
            </dependency>
    </dependencies>

    <build>
            <plugins>
                    <plugin>
                            <groupId>org.liquibase</groupId>
                            <artifactId>liquibase-maven-plugin</artifactId>
                    </plugin>
            </plugins>
    </build>
</project>

WEBAPP

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <!-- [...] -->

    <build>
            <plugins>
                    <plugin>
                            <groupId>org.mortbay.jetty</groupId>
                            <artifactId>maven-jetty-plugin</artifactId>
                    </plugin>
            </plugins>
    </build>
</project>

如果您在其他步骤之前安装了mvn,则可以使用

mvn -pl ChildModule lifecycle

从项目的根级别。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM