2017-07-06 2 views
0

Maven-Antrun-Plugin 1.8を使用して、<if>を含むAntターゲットを実行します。Maven-Antrun-Pluginから<if>を呼び出す

これを実行するにはant-contribが必要なので、私はant-contrib:ant-contrib:1.0b3に依存関係を含めました。これにより、ant:ant:1.5が一時的にロードされ、ビルドが中断されます。私がant 1.5に除外を置くと、<if>は再び定義されません。

要約:<if>を呼び出すことができるmaven-antrun-pluginの有効な依存関係リストが必要です。

+0

Antプロジェクトにant-contribタスクをtypedefしていますか? ant-contrib-1.0b3.jarへのクラスパス依存性を提供するだけでは不十分です。 –

+0

Maven-Antrun-Pluginにtypedefする必要がありますか?もしそうなら、どうですか? –

+0

残念ながら、mavenとの統合が問題に影響を与えるかどうかはわかりません。うまくいけない。純粋なAntを扱う場合、必要な唯一の依存性アーティファクトは 'ant-contrib-1.0b3.jar'です。あなたのAntの 'build.xml'の中で' 'タスクを使う前に、' 'と入力します。 –

答えて

1

はおそらく以下は、あなたのMavenのポンポンに役立つことがあります。

<dependencies> 
    <dependency> 
     <groupId>ant-contrib</groupId> 
     <artifactId>ant-contrib</artifactId> 
     <version>1.0b3</version> 
     <scope>provided</scope> 
     <exclusions> 
      <exclusion> 
       <groupId>ant</groupId> 
       <artifactId>ant</artifactId> 
      </exclusion> 
     </exclusions> 
    </dependency> 
</dependencies> 
<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <version>1.8</version> 
      <executions> 
       <execution> 
        <id>ID_HERE</id> 
        <phase>PHASE_HERE</phase> 
        <goals> 
         <goal>run</goal> 
        </goals> 
        <configuration> 
         <target> 
          <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath"/> 
          <if> 
           <!-- Some if condition here --> 
           <then> 
            <!-- Ant tasks to execute if condition is true --> 
           </then> 
          </if> 
         </target> 
        </configuration> 
       </execution> 
      </executions> 
      <dependencies> 
       <dependency> 
        <groupId>ant-contrib</groupId> 
        <artifactId>ant-contrib</artifactId> 
        <version>1.0b3</version> 
        <exclusions> 
         <exclusion> 
          <groupId>ant</groupId> 
          <artifactId>ant</artifactId> 
         </exclusion> 
        </exclusions> 
       </dependency> 
      </plugin> 
     </plugins> 
    </build> 

を私はこれがあなたの問題に最適な/効率的なソリューションではないかもしれないということを理解し、これは、私は現在、自分自身とそれを使用しています正確に何であります問題なく動作します。

関連する問題