You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2014/11/24 03:23:12 UTC

[Bug 57248] New: Ant 'Fail Unless' task failing even though property is set

https://issues.apache.org/bugzilla/show_bug.cgi?id=57248

            Bug ID: 57248
           Summary: Ant 'Fail Unless' task failing even though property is
                    set
           Product: Ant
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
          Assignee: notifications@ant.apache.org
          Reporter: bharris@integraltech.com.au

I have an Ant script that is failing where it shouldn't.

properties file:

application.foo.name=foo
application.foo.path=[path-to-foo]
application.foo.file=foo.jar
appName=

code:

<target name="deploy_app" description="Deploys app">
  <condition property="appSelected">
    <and>
      <not>
        <equals arg1="${appName}" arg2="" />
      </not>
      <isset property="${appName}" />
    </and>
  </condition>

  <if>
    <equals arg1="${appSelected}" arg2="true" />
   <then>
    <!-- do nothing! -->
   </then>
   <else>
    <input
      message="Please enter application name:"
      addproperty="newAppName"
    />
    <var name="appName" value="${newAppName}" />
  </else>
</if>
  <antcall inheritAll="true" target="deploy" />
</target>

<target name="deploy">
    <echo message="Deploying from property: application.${appName}.file" />
  <propertycopy silent="true" name="appFile" from="application.${appName}.file"
/>
  <propertycopy silent="true" name="appPath" from="application.${appName}.path"
/>
  <echo message="appFile: ${appFile}" />
  <fail unless="${appFile}" message="appfile: ${appFile} No application with
the name ${appName} is defined in your properties file." />
</target>

output:

 [echo] Deploying from property: application.foo.file
 [echo] appFile: foo.jar
ERROR: The following error occurred while executing this line:
appfile: foo.jar No application with the name foo is defined in your properties
file.

It's even printing the property in the <fail> error message.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57248] Ant 'Fail Unless' task failing even though property is set

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57248

bharris@integraltech.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from bharris@integraltech.com.au ---
(In reply to Stefan Bodewig from comment #1)
> try unless="appFile" - the attribute expects the name of the property, not
> its expanded value.

of course..sorry!

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57248] Ant 'Fail Unless' task failing even though property is set

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57248

bharris@integraltech.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bharris@integraltech.com.au
                 OS|                            |All

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 57248] Ant 'Fail Unless' task failing even though property is set

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57248

--- Comment #1 from Stefan Bodewig <bo...@apache.org> ---
try unless="appFile" - the attribute expects the name of the property, not its
expanded value.

-- 
You are receiving this mail because:
You are the assignee for the bug.