maven exec:exec @ mygoal仅适用于某些孩子

时间:2016-07-27 19:41:15

标签: maven exec-maven-plugin

我想使用exec插件将一些工件部署到应用程序服务器(OC4J),但我不想在maven命令中指定特定阶段。所以,我想做的是:

  

mvn exec:exec @ goalid

要触发部署,而不是:

  

mvn package

隐式触发部署

我拥有的是父pom和多个模块。其中一些是罐子,其他是我想要部署的耳朵。

父:

#Input: 
chararr = np.chararray((3, 5))
chararr[:] = 'a'
chararr

#Output: 
chararray([[b'a', b'a', b'a', b'a', b'a'],
   [b'a', b'a', b'a', b'a', b'a'],
   [b'a', b'a', b'a', b'a', b'a']], 
  dtype='|S1')

孩子:

<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>

所以,我在父pom中的pluginmanagement部分指定了插件配置。而且我已经在孩子pom上宣布了exec插件,这可以构建耳朵。

如果我使用特定阶段进行构建,则它仅适用于构建耳朵的子模块,如预期的那样。但是如果我从父pom运行mvn exec:exec @ goalid,maven会在每个孩子中运行exec插件。

我想在打包阶段构建和部署耳朵,但显式

有没有办法让这项工作?

0 个答案:

没有答案