0

I want to deploy some artifacts to an application server (OC4J) using the exec plugin, but I dont want to specify a particular phase at maven command. So, what I would like to do is:

mvn exec:exec@goalid

To trigger the deploy, instead of:

mvn package

that triggers the deploy implicitly

What I have is parent pom and multiple modules. Some of them are jars and others are the ears which I would like to deploy.

Parent:

<project>
<modelVersion>4.0.0</modelVersion>
<groupId>mygroup</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Parent</name>
<description>description</description>
<modules>
    <module>earModule0</module>
    <module>jarModule0</module>
    <module>jarModule1</module>
</modules>
<build>
    <finalName>${project.artifactId}</finalName>
    <pluginManagement>
        <plugins>               
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2</version>
                <executions>
                    <execution>
                        <id>deploy</id>
                        <phase>package</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>                            
                        <configuration>
                            <executable>java</executable>                               
                            <arguments>
                                <argument>-jar</argument>
                                <argument>${oc4j.home}\j2ee\home\admin_client.jar</argument>
                                <argument>${oc4j.deployer}</argument>
                                <argument>${oc4j.user}</argument>
                                <argument>${oc4j.password}</argument>
                                <argument>-validateURI</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>               
        </plugins>
    </pluginManagement>
</build>

Child:

<build>
<plugins>               
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>          
    </plugin>               
</plugins>
</build>

So, I have specified the plugin configuration at the pluginmanagement section within the parent pom. And I have declared the exec plugin at the child pom which builds the ear.

If I build with a particular phase it works only at the child module which builds the ear, as expected. But If I run mvn exec:exec@goalid from the parent pom, maven runs the exec plugin in every child.

I want to build and deploy the ears at package phase, but explicitly

Is there a way to make this work?

alvaro
  • 452
  • 5
  • 13
  • Possible duplicate of [Execute Maven plugin goal on parent module, but not on children](http://stackoverflow.com/questions/1670900/execute-maven-plugin-goal-on-parent-module-but-not-on-children) – question_maven_com Jul 28 '16 at 08:31
  • Just to clarify, it is not the same on certain childs that only on parent. – alvaro Jul 28 '16 at 12:18

0 Answers0