How to over-write the property in Ant?

ant-contrib’s Variable task can do this: <property name=”x” value=”6″/> <echo>${x}</echo> <!– will print 6 –> <var name=”x” unset=”true”/> <property name=”x” value=”12″/> <echo>${x}</echo> <!– will print 12 –> Not recommended, though, it can lead to weird side-effects if parts of your Ant scripts assume immutable property values, and other parts break this assumption.

ant task to remove files from a jar

Have you tried using the zipfileset task? <jar destfile=”stripped.jar”> <zipfileset src=”full.jar” excludes=”files/to/exclude/**/*.file” /> </jar> Example <property name=”library.dir” value=”dist” /> <property name=”library.file” value=”YourJavaArchive.jar” /> <property name=”library.path” value=”${library.dir}/${library.file}” /> <property name=”library.path.new” value=”${library.dir}/new-${library.file}” /> <target name=”purge-superfluous”> <echo>Removing superfluous files from Java archive.</echo> <jar destfile=”${library.path.new}”> <zipfileset src=”${library.path}” excludes=”**/ComicSans.ttf” /> </jar> <delete file=”${library.path}” /> <move file=”${library.path.new}” tofile=”${library.path}” /> </target>

How can I allow an Ant property file to override the value set in another?

The initial problem with your set up is that you’ve got build.properties and build-defaults.properties reversed. Ant Properties are set once and then can never be overridden. That’s why setting any property on the command line via a -Dproperty=value will always override anything you’ve set in the file; the property is set and then nothing can … Read more

Create cross platform Java SWT Application

I’ve just run into the same problem. I haven’t tried it yet, but I plan to include versions of swt.jar for all platforms and load the correct one dynamically in the start of the main method. UPDATE: It worked. build.xml includes all jars: <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_linux_gtk_x86.jar”/> <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_macosx_x86.jar”/> <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_win32_x86.jar”/> <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_linux_gtk_x64.jar”/> … Read more

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

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)