code_junkie

subant failonerror subtleties

Nov 14th, 2011
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. <target name="all-release" >
  2. <subant target="sub-release" failonerror="true">
  3. <fileset dir="." includes="*/build.xml" />
  4. </subant>
  5. </target>
  6.  
  7. <taskdef resource="net/sf/antcontrib/antlib.xml">
  8. <classpath>
  9. <pathelement location="lib/ant-contrib-1.0b3.jar"/>
  10. </classpath>
  11. </taskdef>
  12.  
  13. <target name="all-release">
  14. <for keepgoing="true" param="file">
  15. <path>
  16. <fileset dir="." includes="*/build.xml" />
  17. </path>
  18. <sequential>
  19. <ant antfile="@{file}" target="sub-release" />
  20. </sequential>
  21. </for>
  22. </target>
  23.  
  24. $ ant all-release
  25. Buildfile: build.xml
  26.  
  27. all-release:
  28. [echo] /work/Scratch/dir1/build.xml
  29.  
  30. sub-release:
  31. [echo] dir1
  32. [echo] /work/Scratch/dir2/build.xml
  33.  
  34. sub-release:
  35. [echo] dir2
  36. [for] /work/Scratch/dir2/build.xml: The following error occurred while executing this line:
  37. [for] /work/Scratch/build.xml:17: The following error occurred while executing this line:
  38. [for] /work/Scratch/dir2/build.xml:6: dir2 failed
  39. [echo] /work/Scratch/dir3/build.xml
  40.  
  41. sub-release:
  42. [echo] dir3
  43.  
  44. BUILD FAILED
  45. /work/Scratch/build.xml:11: Keepgoing execution: 1 of 3 iterations failed.
  46.  
  47. Total time: 0 seconds
  48.  
  49. <taskdef name="try" classname="ise.antelope.tasks.TryTask"/>
  50. ....
  51. <try break="false" printmessage="true" >
  52. <antcall target="xmlValidate" />
  53. <antcall target="runJunit" />
  54. <antcall target="..." />
  55. <catch>
  56. <property name="haderrors" value="true"/>
  57. </catch>
  58. </try>
  59. <fail message="FAILED" if="haderrors" />
Add Comment
Please, Sign In to add comment