Domanda

I've got a super POM gathering versions, plugin & dependency definitions for its 2 child submodules: one for a webapp (running with jetty:run), the other one for DB migrations ("running" with liquibase:update).

This works fine so long as I changed the directory to one of the submodules'. However, when I run jetty:run or liquibase:update on the parent POM, I'd like to see the plugin execution "forwarded" to the corresponding submodule.

Do you have any idea if such a thing can be achieved?

Thanks in advance,

Rolf

P.S.: sorry for the late update

PARENT 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>
È stato utile?

Soluzione

If you have made an mvn install before other steps you can use

mvn -pl ChildModule lifecycle

from the root level of your project.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top