You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Stefan Franke (JIRA)" <ji...@codehaus.org> on 2008/12/09 11:22:19 UTC

[jira] Issue Comment Edited: (MANTRUN-86) Cannot handle multiple tasks elements

    [ http://jira.codehaus.org/browse/MANTRUN-86?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=157372#action_157372 ] 

Stefan Franke edited comment on MANTRUN-86 at 12/9/08 4:21 AM:
---------------------------------------------------------------

a workaround is to add ant-contrib to the ant classpath and then use <if> inside of the single target:
{code}
<!-- can contain typos, since I wrote this from scratch... -->
<configuration>
  <tasks>
    <taskdef name="if" classname="net.sf.antcontrib.logic.IfTask" />
    <if>
      <!-- maybe there is a more elegant way to check a property... -->
      <contains string="${jboss.local.repository}" substring="{jboss.local.repository}">
        <then>
          <property name="version.id" value="${project.version}"/>
          <property name="jboss.local.repository" value="${jboss.local.repository}"/>
          <ant antfile="ant/build-install.xml" target="install"/>
      </then>
      <else>
          <echo message="Cannot install to jboss.local.repository=${jboss.local.repository}"/>
       </else>
      </contains>
    </if>
  </tasks>
</configuration>
{code}

      was (Author: bebbo):
    a workaround is to add ant-contrib to the ant classpath and then use <if> inside of the single target:

<!-- can contain typos, since I wrote this from scratch... -->
<configuration>
  <tasks>
    <taskdef name="if" classname="net.sf.antcontrib.logic.IfTask" />
    <if>
      <!-- maybe there is a more elegant way to check a property... -->
      <contains string="${jboss.local.repository}" substring="{jboss.local.repository}">
        <then>
          <property name="version.id" value="${project.version}"/>
          <property name="jboss.local.repository" value="${jboss.local.repository}"/>
          <ant antfile="ant/build-install.xml" target="install"/>
      </then>
      <else>
          <echo message="Cannot install to jboss.local.repository=${jboss.local.repository}"/>
       </else>
      </contains>
    </if>
  </tasks>
</configuration>

  
> Cannot handle multiple tasks elements
> -------------------------------------
>
>                 Key: MANTRUN-86
>                 URL: http://jira.codehaus.org/browse/MANTRUN-86
>             Project: Maven 2.x Antrun Plugin
>          Issue Type: Bug
>    Affects Versions: 1.1
>            Reporter: Thomas Diesler
>
> {code:xml}
> <plugin>
>   <artifactId>maven-antrun-plugin</artifactId>
>   <executions>
>     <execution>
>       <phase>install</phase>
>       <goals>
>         <goal>run</goal>
>       </goals>
>       <configuration>
>         <tasks if="jboss.local.repository">
>           <property name="version.id" value="${project.version}"/>
>           <property name="jboss.local.repository" value="${jboss.local.repository}"/>
>           <ant antfile="ant/build-install.xml" target="install"/>
>         </tasks>
>         <tasks unless="jboss.local.repository">
>           <echo message="Cannot install to jboss.local.repository=${jboss.local.repository}"/>
>         </tasks>
>       </configuration>
>     </execution>
>   </executions>
> </plugin>
> {code}
> Always executes the last tasks element although 'jboss.local.repository' is set
> [INFO] [antrun:run {execution: default}]
> [INFO] Executing tasks
>      [echo] Cannot install to jboss.local.repository=/home/tdiesler/svn/jboss.local.repository
> [INFO] Executed tasks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira