2012-02-16 6 views
0

システムプロパティが設定されている場合、 'exec-maven-plugin'を実行します。これをMaven 3.xでどのように達成できますか?例えばMaven 3.xでシステムプロパティIDが設定されている場合、exec-maven-pluginを実行するには?

、与えられた:

mvn clean install -DrunTheExec="yes" 

その後、私はこのロジックを実装する方法:

<!-- if $(runTheExec) == yes then run this plugin --> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>exec-maven-plugin</artifactId> 
      ... 
     </plugin> 

答えて

1

私はジョナサンと同じ提案を追加するちょうど約だったが、少し違ったプロファイルを使用しました。

mvn clean install -PrunTheExec 
+0

どちらが良い答えですが、デフォルトのオプションが素敵なアドオンであるので、私は答えとして、このいずれかを選択する必要があります:

<profiles> <profile> <id>runTheExec</id> <activation> <activeByDefault>false</activeByDefault> </activation> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> ... 

は、それをアクティブにします。私は両方の答えに投票します。 – TERACytE

3

あなたはそれの内部で定義されたプラグインで、あなたのポンポンでプロファイルを定義する必要があります。あなたの例では、これは次のようになります。

<profiles> 
    <profile> 
    <activation> 
     <property> 
     <name>runTheExec</name> 
     <value>yes</value> 
     </property> 
    </activation> 
    <plugins> 
     <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>exec-maven-plugin</artifactId> 
     ... 
     </plugin> 
    </plugins> 
    </profile> 
</profiles> 
関連する問題