2016-08-25 6 views
0

여러 모듈이있는 상위 집계 자 POM이 있습니다. 나는 각 하위 모듈에 대해 플러그인 실행이 동일하기 때문에 부모에 build/pluginManagement이 있습니다.Maven Plugin 상위 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와 위상을 지정해야 할 것 모든 하위 모듈에서 실행되며 플러그인 구성을위한 장소는 하나뿐입니다.

참고 : 정적 실행 ID를 사용해 보았지만 하위 모듈에서도 실행을 건너 뛰는 부작용이 있습니다. 또한이 모든 문제가 wildfly-maven-plugin에 있는지 확실하지 않습니다.