2011-11-10 17 views

答えて

16

いいえ、プロファイルを継承することはできません。

しかし、複数のアクティブなプロファイルを持つことができます。これにより、2つのプロファイルの共通要素を他の2つのプロファイルのいずれかをアクティブにするたびにアクティブ化する3つ目のプロファイルに分解することで、

1

厳密に言えば、親pomで定義されたプロファイルは、Mavenのドキュメントのように、子プロセスでは利用できません。ただし、親pomsで指定されているプロパティおよびビルドプラグイン(pluginManagementではなく)はアクティブになり、子ポームのビルド環境を変更できます。たとえば 私は、次のプロファイルセクションを持つ親ポンポンA、持っている場合:

</profiles> 
     <profile> 
      <id>integrationTest</id> 
      <build> 
       <plugins> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-surefire-plugin</artifactId> 
         <configuration> 
          <parallel>none</parallel> 
          <excludes> 
           <exclude>**/*Test.java</exclude> 
          </excludes> 
         </configuration> 
        </plugin> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-failsafe-plugin</artifactId> 
         <configuration> 
          <includes 
           <include>**/*IT.java</include> 
          </includes> 
          <!-- need to exclude nothing as it is possible that some by default some tests are excluded and we need to override that --> 
          <excludes> 
           <exclude>none</exclude> 
          </excludes> 
          <parallel>none</parallel> 
         </configuration> 
        </plugin>    
       </plugins> 
      </build> 
     </profile> 
    </profiles> 

そして、デフォルトのビルドで構成されたフェイルセーフプラグインを持っていますが、経由POMを継承していない子ポンポンBを親タグを開き、子pomディレクトリから「mvn clean install -P integrationTest」を実行すると、Aで指定されたプラグイン情報が取得されます。

関連する問題