{"id":1582,"date":"2009-05-11T17:35:32","date_gmt":"2009-05-12T00:35:32","guid":{"rendered":"http:\/\/www.alephnaught.com\/Blog\/?page_id=1582"},"modified":"2009-05-11T17:35:32","modified_gmt":"2009-05-12T00:35:32","slug":"ant-tasks","status":"publish","type":"page","link":"https:\/\/www.alephnaught.com\/Blog\/ant-tasks\/","title":{"rendered":"Ant Tasks"},"content":{"rendered":"<div id=\"content_div-1582\">\n<p>I&#8217;ve written a few things to make my builds easier at home, and I finally   figured I should share them with the community (and I finally had time to make   a distribution jar and these web pages).<\/p>\n<p>The jar file that contains some loggers and an ant task is <a href=\"..\/..\/Ant\/anns-ant-dist.jar\">anns-ant-dist.jar<\/a>.<\/p>\n<p>The ant task is called <em>jnlpsize<\/em>; it updates the sizes for items in   JNLP files using the href address. Here is an example usage:<\/p>\n<blockquote><p><span style=\"font-family: Courier New,Courier,mono; font-size: x-small;\">&lt;taskdef name=&#8221;jnlpsize&#8221; classname=&#8221;net.alephnaught.ant.task.UpdateJNLPSizes&#8221; \/&gt;<br \/>\n<\/span><span style=\"font-family: Courier New,Courier,mono; font-size: x-small;\">&lt;target name=&#8221;test&#8221;&gt;<br \/>\n&lt;jnlpsize jnlpfilename=&#8221;\/Users\/roberthays\/AlephNaught\/WebStart\/working.jnlp&#8221;\/&gt;<br \/>\n&lt;\/target&gt;<\/span><\/p><\/blockquote>\n<p>Note that it takes one argument, the location of the JNLP file to update.   I find this really useful to put near the end of my build script that builds   my JNLP-released software.<\/p>\n<p>In addition, the distribution contains some logging tools I wrote. The most   interesting item is net.alephnaught.ant.event.LoggerFactory; this logger reads   a properties file and executes any loggers configured inside it. This was a   hack to allow me to log to a text file while also logging to an RSS feed and   an XML file. Here&#8217;s the build script I use to run ant:<\/p>\n<blockquote><p><span style=\"font-family: Courier New,Courier,mono; font-size: x-small;\">#!\/bin\/bash<\/span><\/p>\n<p><span style=\"font-family: Courier New,Courier,mono; font-size: x-small;\">datemarker=`date &#8216;+%y%m%d%H%M%S&#8217;`<br \/>\nlogfile=build_$datemarker.txt<br \/>\ntxtlogfile=\/Library\/WebServer\/Documents\/Build\/$logfile<br \/>\nrssfile=\/Library\/WebServer\/Documents\/Build\/RSSLogger.xml<\/span><\/p>\n<p><span style=\"font-family: Courier New,Courier,mono; font-size: x-small;\">ant -logger net.alephnaught.ant.event.LoggerFactory         -DRSSLogger.output_file=$rssfile -DRSSLogger.build_link=http:\/\/localhost\/Build\/$logfile         $* | tee $txtlogfile<\/span><\/p><\/blockquote>\n<p>The properties file must be named <em>LoggerFactory.properties<\/em> and must be on     the <strong>classpath<\/strong>. I use the following content for mine:<\/p>\n<blockquote><p><span style=\"font-family: Courier New,Courier,mono; font-size: x-small;\">LoggerFactory.logger=org.apache.tools.ant.DefaultLogger,net.alephnaught.ant.event.RSSLogger,net.alephnaught.ant.event.AntPerformanceLogger<br \/>\nLoggerFactory.passthru=false<\/span><\/p><\/blockquote>\n<p>You can have multiple <em>LoggerFactory.logger<\/em> lines and each will be called.   The <em>passthru<\/em> property tells the factory whether to eat exceptions internally   or pass them to ant.<\/p>\n<p>In addition there&#8217;s a class that converts the excellent <em>net.sf.antcontrib.perf.AntPerformanceListener<\/em> to   a logger, an <em>RSSLogger<\/em> that creates an entry for each build indicating   success or failure and a link to the text\/XML file with the whole build log,   and a   <em>JabberLogger<\/em> that uses the JabberBeans library to output log information   to subscribed Jabber listeners. The source code is included in the jar file,   and its all covered under the Eclipse license (CPL). If you make changes, please   pass them back to me for inclusion in the main tree.<\/p>\n<\/div>\n<div class=\"translate_block\" style=\"display: none;\">\n<hr class=\"translate_hr\" \/>\n<a class=\"translate_translate\" id=\"translate_button_post-1582\" lang=\"en\" xml:lang=\"en\" href=\"javascript:show_translate_popup('en', 'post', 1582);\"><span>Translate<\/span><\/a><img data-recalc-dims=\"1\" src=\"https:\/\/i0.wp.com\/www.alephnaught.com\/Blog\/wp-content\/plugins\/google-ajax-translation\/transparent.gif?resize=16%2C16&#038;ssl=1\" id=\"translate_loading_post-1582\" class=\"translate_loading colorbox-1582\" style=\"display: none;\" width=\"16\" height=\"16\" alt=\"\" \/>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve written a few things to make my builds easier at home, and I finally figured I should share them with the community (and I finally had time to make a distribution jar and these web pages). The jar file that contains some loggers and an ant task is anns-ant-dist.jar. The ant task is called [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-1582","page","type-page","status-publish","hentry"],"aioseo_notices":[],"jetpack_shortlink":"https:\/\/wp.me\/P2w3Qj-pw","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.alephnaught.com\/Blog\/wp-json\/wp\/v2\/pages\/1582","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.alephnaught.com\/Blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.alephnaught.com\/Blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.alephnaught.com\/Blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.alephnaught.com\/Blog\/wp-json\/wp\/v2\/comments?post=1582"}],"version-history":[{"count":0,"href":"https:\/\/www.alephnaught.com\/Blog\/wp-json\/wp\/v2\/pages\/1582\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.alephnaught.com\/Blog\/wp-json\/wp\/v2\/media?parent=1582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}