2016-08-25 8 views
0

私は複数のモジュールを持つ親アグリゲータPOMを持っています。私はbuild/pluginManagementを親に持っています。プラグインの実行は各サブモジュールで同じですから。Mavenプラグインの親POM実行をスキップする方法は?

各サブモジュール(mvn package)で実行するとうまく動作します。私は親に実行する場合:mvn package -Pmytestを、私は親モジュールにプラグインの実行をスキップしたいので、私はコメントを追加しました:

<plugin> 
     <groupId>org.wildfly.plugins</groupId> 
     <artifactId>wildfly-maven-plugin</artifactId> 
     <configuration> 
      <skip>true</skip> 
     </configuration> 
    </plugin> 

しかし、それは働いていません。

親のpom.xml:

<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/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.xyz.jboss.config</groupId> 
    <artifactId>jboss-config</artifactId> 
    <packaging>pom</packaging> 
    <version>1.2-SNAPSHOT</version> 
    <name>jboss-config</name> 
    <url>http://maven.apache.org</url> 

    <profiles> 
     <profile> 
      <id>mytest</id> 
      <modules> 
       <module>jboss-system-properties</module> 
       <module>jboss-security</module> 
      </modules> 
     </profile> 
    </profiles> 
    <build> 
     <pluginManagement> 
      <plugins> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-resources-plugin</artifactId> 
        <executions> 
         <execution> 
          <id>process-package</id> 
          <phase>package</phase> 
          <goals> 
           <goal>copy-resources</goal> 
          </goals> 
          <configuration> 
           <outputDirectory>${basedir}/processed/scripts</outputDirectory> 
           <resources> 
            <resource> 
             <directory>${basedir}/src/main/resources/scripts</directory> 
             <filtering>true</filtering> 
            </resource> 
           </resources> 
          </configuration> 
         </execution> 
         <execution> 
          <id>process-clean</id> 
          <phase>clean</phase> 
          <goals> 
           <goal>copy-resources</goal> 
          </goals> 
          <configuration> 
           <outputDirectory>${basedir}/processed/scripts</outputDirectory> 
           <resources> 
            <resource> 
             <directory>${basedir}/src/main/resources/scripts</directory> 
             <filtering>true</filtering> 
            </resource> 
           </resources> 
          </configuration> 
         </execution> 
        </executions> 
       </plugin> 
       <plugin> 
        <groupId>org.wildfly.plugins</groupId> 
        <artifactId>wildfly-maven-plugin</artifactId> 
        <executions> 
         <execution> 
          <id>add-${project.artifactId}</id> 
          <phase>package</phase> 
          <goals> 
           <goal>execute-commands</goal> 
          </goals> 
          <configuration> 
           <execute-commands> 
            <scripts> 
             <script>${basedir}/processed/scripts/add-${project.artifactId}.cli</script> 
            </scripts> 
           </execute-commands> 
          </configuration> 
         </execution> 
         <execution> 
          <id>remove-${project.artifactId}</id> 
          <phase>clean</phase> 
          <goals> 
           <goal>execute-commands</goal> 
          </goals> 
          <configuration> 
           <execute-commands> 
            <scripts> 
             <script>${basedir}/processed/scripts/remove-${project.artifactId}.cli</script> 
            </scripts> 
           </execute-commands> 
          </configuration> 
         </execution> 
        </executions> 
       </plugin> 
      </plugins> 
     </pluginManagement> 

     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-resources-plugin</artifactId> 
       <configuration> 
        <skip>true</skip> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.wildfly.plugins</groupId> 
       <artifactId>wildfly-maven-plugin</artifactId> 
       <configuration> 
        <skip>true</skip> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

子のpom.xml

<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/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <parent> 
     <groupId>com.xyz.jboss.config</groupId> 
     <artifactId>jboss-config</artifactId> 
     <version>1.2-SNAPSHOT</version> 
    </parent> 
    <artifactId>jboss-system-properties</artifactId> 
    <packaging>ear</packaging> 
    <name>jboss-system-properties</name> 
    <url>http://maven.apache.org</url> 
</project> 

私は、ファイルが見つからないというエラーを取得しています。ファイルはここには存在しないはずです。問題は、親モジュールの実行をスキップしない理由です。

[INFO] ------------------------------------------------------------------------ 
[INFO] Reactor Summary: 
[INFO] 
[INFO] jboss-config ....................................... FAILURE [ 20.238 s] 
[INFO] jboss-system-properties ............................ SKIPPED 
[INFO] jboss-security ..................................... SKIPPED 
[INFO] ------------------------------------------------------------------------ 

[ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.0.2.Final: 
    execute-commands (add-jboss-config) on project jboss-config: 
    Execution add-jboss-config of goal org.wildfly.plugins:wildfly-maven-plugin:1.0.2.Final:execute-commands failed: 
    Failed to process file 'H:\projects\xyz\jboss\trunk\jboss-configuration\processed\scripts\add-jboss-config.cli': 
    H:\projects\xyz\jboss\trunk\jboss-configuration\processed\scripts\add-jboss-config.cli 
    (The system cannot find the path specified) 

答えて

1

問題が見つかりました。実行IDがパラメータ化されている場合は、私の場合:、それは親をスキップし、今

 <plugin> 
      <groupId>org.wildfly.plugins</groupId> 
      <artifactId>wildfly-maven-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>add-jboss-config</id> 
        <phase/> 
       </execution> 
       <execution> 
        <id>remove-jboss-config</id> 
        <phase/> 
       </execution> 
      </executions> 
      <configuration> 
       <skip>true</skip> 
      </configuration> 
     </plugin> 

<plugin> 
     <groupId>org.wildfly.plugins</groupId> 
     <artifactId>wildfly-maven-plugin</artifactId> 
     <executions> 
      <execution> 
       <id>add-${project.artifactId}</id> 
... 
... 
     <executions> 
      <execution> 
       <id>remove-${project.artifactId}</id> 
... 
... 

は、プラグインの実行をスキップするには、明示的に実行IDと位相を指定する必要があるだろうすべての子モジュールで実行され、プラグインの設定には1つの場所しかありません。

注:静的実行IDを使用しようとしましたが、子モジュールでも実行をスキップするという副作用があります。また、これらの問題がすべてwildfly-maven-pluginに入っているかどうかはわかりません。

関連する問題