How to check if a property exists?

You can use the Condition task with an isset condition. <project default=”test”> <property name=”a” value=”a”/> <target name=”test”> <condition property=”a.set” else=”false”> <isset property=”a”/> </condition> <condition property=”b.set” else=”false”> <isset property=”b”/> </condition> <echo message=”a set ? ${a.set}”/> <echo message=”b set ? ${b.set}”/> </target> </project> Output: test: [echo] a set ? true [echo] b set ? false

Error installing Ant: ANT_HOME is set incorrectly

It sounds like you have it setup right. What happens if you try something like this, which worked for me: C:\>set ANT_HOME=C:\apache-ant-1.8.1 C:\>set JAVA_HOME=C:\jdk1.6.0_24 C:\>set PATH=%ANT_HOME%\bin;%JAVA_HOME%\bin C:\>ant -version Apache Ant version 1.8.1 compiled on April 30 2010 This also worked for me by setting up environment variables, like so:

jacoco code coverage report generator showing error : “Classes in bundle ‘Code Coverage Report’ do no match with execution data”

You are getting the error related to classID. This is a concept described in detail at JaCoCo docs-site. http://www.eclemma.org/jacoco/trunk/doc/classids.html. This is a key step for supporting multiple versions of class (an appserver for example) in same JVM. Copying part some part of it here for visibility. What are class ids and how are they created? … Read more

Android signing with Ant

If you have Ant version < 1.8.3 (ant -version) try this approach for the issue with JDK 7 (based on the previous answer): Add signjarjdk7 to ANDROID_SDK\tools\ant\build.xml <macrodef name=”signjarjdk7″> <attribute name=”jar” /> <attribute name=”signedjar” /> <attribute name=”keystore” /> <attribute name=”storepass” /> <attribute name=”alias” /> <attribute name=”keypass” /> <attribute name=”verbose” /> <sequential> <exec executable=”jarsigner” failonerror=”true”> <!– … Read more

How to check if a property has value in Ant

You can use conditions using the <fail> task: <fail message=”Property &quot;foo&quot; needs to be set to a value”> <condition> <or> <equals arg1=”${foo}” arg2=””/> <not> <isset property=”foo”/> </not> </or> </condition> This is equivalent to saying if (not set ${foo} or ${foo} = “”) is pseudocode. You have to read the XML conditions from the inside out. … Read more

build.xml in Java project

build.xml usually is an ant build script. It contains information necessary to build the project to produce the desired output, be it Javadocs, a compiled project, or a JAR file. I believe Eclipse has ant built-in, so it should be possible to execute the build.xml by choosing “Run As…” and “Ant Build”. The build.xml file, … Read more

Java Build Tools: Ant vs. Maven [closed]

It really depends. Maven and Ant are just different approaches: imperative and declarative (see Imperative vs Declarative build systems) Maven is better for managing dependencies (but Ant is ok with them too, if you use Ant+Ivy) and build artefacts. The main benefit from maven – its lifecycle. You can just add specific actions on correct … Read more