Ant Tips: Difference between revisions
(New page: == Use ant to create a properties java file which can be compiled == <geshi lang="xml"> <target name="build-properties"> <copy todir="src"> <fileset dir="src"> ...) |
|||
Line 17: | Line 17: | ||
==Ant is great, but the XML gets to suck after a while.== | ==Ant is great, but the XML gets to suck after a while.== | ||
*If I knew then what I knew now, I would have tried using a real scripting language, such as ~JavaScript via the Rhino component or Python via JPython, with bindings to Java objects which implemented the functionality expressed in todays tasks. Then, there would be a first class way to express logic and we wouldn't be stuck with XML as a format that is too bulky for the way that people really want to use the tool. | |||
**Excerpt from [http://x180.net/Journal/2004/03/31.html James Duncan Davidson], the author of Ant. | |||
==Ant is giving you this error when using a fileset:== | ==Ant is giving you this error when using a fileset:== |
Revision as of 07:12, 23 September 2007
Use ant to create a properties java file which can be compiled
<geshi lang="xml">
<target name="build-properties"> <copy todir="src"> <fileset dir="src"> <include name="**/*.hava"/> </fileset> <globmapper from="*.hava" to="*.java"/> <filterset> <filtersfile file="src/resources/messages_en_AU_company.properties" /> </filterset> </copy> </target>
</geshi>
Ant is great, but the XML gets to suck after a while.
- If I knew then what I knew now, I would have tried using a real scripting language, such as ~JavaScript via the Rhino component or Python via JPython, with bindings to Java objects which implemented the functionality expressed in todays tasks. Then, there would be a first class way to express logic and we wouldn't be stuck with XML as a format that is too bulky for the way that people really want to use the tool.
- Excerpt from James Duncan Davidson, the author of Ant.
Ant is giving you this error when using a fileset:
java.lang.NoClassDefFoundError: org/apache/oro/text/regex/MalformedPatternException
You need to download the Jararta ORO libarary. Install the jar in you ant/lib directory.
! You get some stack trace like this:
java.lang.NumberFormatException: multiple points at java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1067) at java.lang.Double.parseDouble(Double.java:220) at java.text.DigitList.getDouble(DigitList.java:127) at java.text.DecimalFormat.parse(DecimalFormat.java:1070) at java.text.SimpleDateFormat.subParse(SimpleDateFormat.java:1705) at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1156) at java.text.DateFormat.parse(DateFormat.java:333)
This might be caused by your ~SimpleDateFormat object being used concurrently. The spec says you can't:
Date formats are not synchronized. It is recommended to create separate format instances for each thread. If multiple threads access a format concurrently, it must be synchronized externally.
How to require an environment variable in an Ant file
<property environment="env"/><BR> <fail message="Provide MY_VAR" unless="env.MY_VAR"/>