{"id":48,"date":"2012-02-02T12:32:11","date_gmt":"2012-02-02T11:32:11","guid":{"rendered":"http:\/\/www.flamingpenguin.co.uk\/blog\/?p=48"},"modified":"2012-02-02T12:32:11","modified_gmt":"2012-02-02T11:32:11","slug":"embedding-and-extending-apache-ant-testing-properties","status":"publish","type":"post","link":"https:\/\/www.flamingpenguin.co.uk\/blog\/2012\/02\/02\/embedding-and-extending-apache-ant-testing-properties\/","title":{"rendered":"Embedding and Extending Apache Ant &#8211; testing properties"},"content":{"rendered":"<p>If you want to test a property from a custom task in Apache Ant 1.8, you can use the <code>testUnlessCondition<\/code> and <code>testIfCondition<\/code> in <code>org.apache.tools.ant.PropertyHelper<\/code>:<\/p>\n<pre lang=\"Java\">\r\n@Override\r\npublic void execute() throws BuildException\r\n{\r\n   final PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(getProject());\r\n   if(propertyHelper.testUnlessCondition(requiredPropertyName))\r\n   {\r\n      \/\/ property is missing\r\n   }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you want to test a property from a custom task in Apache Ant 1.8, you can use the testUnlessCondition and testIfCondition in org.apache.tools.ant.PropertyHelper: @Override public void execute() throws BuildException { final PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(getProject()); if(propertyHelper.testUnlessCondition(requiredPropertyName)) { \/\/ property &hellip; <a href=\"https:\/\/www.flamingpenguin.co.uk\/blog\/2012\/02\/02\/embedding-and-extending-apache-ant-testing-properties\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28,7],"tags":[],"class_list":["post-48","post","type-post","status-publish","format-standard","hentry","category-ant","category-java"],"_links":{"self":[{"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/posts\/48","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=48"}],"version-history":[{"count":0,"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/posts\/48\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flamingpenguin.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}