親pomで抑制したい実行にid
というタグが付いている場合は、Ryan Stewartの答えが働きます。しかし、親のpomがid
で実行をタグ付けしていない場合(もちろん、その親のpomを編集することはできません)、次のようにすると親のpomの動作が抑制されます。
- まず、別の実行を作成し、それを
id
を与え、あなたはそれが何をする必要があるか、それでやるnone
- に、実行の段階を設定します。
mvn help:effective-pom
を実行して、必要なものが親のpomから抑制されていることを正しく確認していることを確認してください。
はここに例を示します
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<inherited>true</inherited>
</plugin>
私はjar-no-fork
に目標を変更するために必要な: これは私の親ポンポンのように見えた方法です。親pomでの実行には、無効にするために使用できるid
が含まれていないことに注意してください。これは効果的な-ポンポンがどのように見えるかで結果
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<phase>none</phase>
</execution>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
:だからここに私の子供のPOMに追加何
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<phase>none</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<archive>
<compress>false</compress>
</archive>
</configuration>
</execution>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
<configuration>
<archive>
<compress>false</compress>
</archive>
</configuration>
</execution>
</executions>
<inherited>true</inherited>
<configuration>
<archive>
<compress>false</compress>
</archive>
</configuration>
</plugin>
これがゴールjar
が実行されず、唯一の目標jar-no-fork
実行決してことを保証 - これは私が達成したかったものです。
私はそれがそれのようなものであることを知っていましたが、私はまだ黄色のベルトです(私の最近の歴史のMavenの質問の道から推測しなかった場合)。私は[this](http://stackoverflow.com/questions/7589931/how-should-i-share-maven-depdendencymanagement-from-multiple-sources)のためにプロジェクトを別の親に移すことはできませんが、私はレポートプラグインのバインドを解除します。ありがとう! – Coderer
この方法は、親モジュールのプラグインに ''が指定されていないと機能しません。 –
EvgeniySharapov
@evgeniysharapovこの場合、子モジュールではまだ 'なし 'を使用できます。[この回答](http://stackoverflow.com/a/14653088/1155724)を参照してください。 –