File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Condtional check for failure property. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Condtional check for failure property." Watch "Condtional check for failure property." New topic

Condtional check for failure property.

Jaya Lalla

Joined: May 22, 2012
Posts: 3
I am trying to do the following in my ant build file.
Run my junit tests based on if the junit.error property is set - I need to run another ant task.
I need to check for both pass an failure of the tests.

I have tried the following with in my target

it does not print the statement.

I get an error saying
C:\apps\workspace-next13.3\CompositePageService\build.xml:418: Problem: failed to create task or type if
Cause: The name is undefined.

I have tried.
<if name="junit.error" value="true">
<echo> there has been a failure </echo>
however if there is no failure the variable may not be set.
Can someone please help with the tags that should be set.

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

Welcome to CodeRanch! I edited your post to add code tags - this makes it easier to read.

Your code looks fine. It uses the if tag from the ant contrib library. Have you added a taskdef tag to your Ant build to include it?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Condtional check for failure property.
It's not a secret anymore!