1

I have got the following Ant target:

  <target name="install-run">
    <echo message="Install Drupal"/>
    <exec executable="${vendorbindir}/drush" dir="${basedir}/${drupalroot}">
      <arg value="site-install"/>
      <arg value="-y"/>
      <arg value="minimal"/>
      <if>
        <not>
          <equals arg1="${db.url}" arg2=""/>
          <then>
            <arg value="--db-url=${db.url}"/>
          </then>
        </not>
      </if>
    </exec>
  </target>

where I would like to pass --db-url argument, only if ${db.url} property does exist.

However, the syntax is not allowed and build is producing the following error:

exec doesn't support the nested "if" element

What would be the proper syntax to achieve the same thing?

I am using Ant v1.10.2.

kenorb
  • 155,785
  • 88
  • 678
  • 743

0 Answers0