<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Frank Caputo's Blog</title>
	<atom:link href="http://frankcaputo.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://frankcaputo.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Fri, 06 Mar 2009 12:23:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='frankcaputo.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Frank Caputo's Blog</title>
		<link>http://frankcaputo.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://frankcaputo.wordpress.com/osd.xml" title="Frank Caputo&#039;s Blog" />
	<atom:link rel='hub' href='http://frankcaputo.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Update for Peter Thomas&#8217; maven-antprops-plugin</title>
		<link>http://frankcaputo.wordpress.com/2009/03/05/update-for-peter-thomas-maven-antprops-plugin/</link>
		<comments>http://frankcaputo.wordpress.com/2009/03/05/update-for-peter-thomas-maven-antprops-plugin/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 17:12:42 +0000</pubDate>
		<dc:creator>Frank Caputo</dc:creator>
				<category><![CDATA[netbeans]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[ear]]></category>
		<category><![CDATA[ejb]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[war]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[When I found Peter&#8217;s maven-antprops-plugin, I was really happy about the the goal antprops:nbjavaee. I used it to evaluate some web-frameworks, for which maven-archetypes were available. I was less happy, when I had to code some EJBs based on POMs, and saw the plugin only works for WARs. So I decided to improve it and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=frankcaputo.wordpress.com&amp;blog=6840575&amp;post=1&amp;subd=frankcaputo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When I found <a href="http://ptrthomas.wordpress.com/2008/08/17/an-alternative-maven-plugin-for-ant-and-netbeans">Peter&#8217;s maven-antprops-plugin</a>, I was really happy about the the goal antprops:nbjavaee. I used it to evaluate some web-frameworks, for which maven-archetypes were available. I was less happy, when I had to code some EJBs based on POMs, and saw the plugin only works for WARs. So I decided to improve it and add the following features to the goal antprops:nbjavaee:</p>
<ul>
<li>differentiate between test-libs and other libs</li>
<li>work with ejb- and ear-projects</li>
<li>attach sources and javadocs if available in local maven repository</li>
</ul>
<p>We call this plugin in every clean in NetBeans&#8217;s build.xml:</p>
<pre class="xml">    &lt;target name="-post-clean"&gt;
        &lt;exec executable="mvn.bat" dir="${basedir}" osfamily="windows"&gt;
            &lt;arg value="clean"/&gt;
            &lt;arg value="eclipse:eclipse"/&gt;
            &lt;arg value="eclipse:clean"/&gt;
            &lt;arg value="antprops:nbjavaee"/&gt;
            &lt;arg value="-DdownloadSources=true"/&gt;
            &lt;arg value="-DdownloadJavadocs=true"/&gt;
        &lt;/exec&gt;
        &lt;exec executable="mvn" dir="${basedir}" osfamily="mac"&gt;
            &lt;arg value="clean"/&gt;
            &lt;arg value="eclipse:eclipse"/&gt;
            &lt;arg value="eclipse:clean"/&gt;
            &lt;arg value="antprops:nbjavaee"/&gt;
            &lt;arg value="-DdownloadSources=true"/&gt;
            &lt;arg value="-DdownloadJavadocs=true"/&gt;
        &lt;/exec&gt;
    &lt;/target&gt;</pre>
<p>We abuse the maven-eclipse-plugin to download the sources and javadocs for all our dependencies <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  All sources and javadocs found in the local maven repository are automatically attached to the libraries in NetBeans. This is really helpfull for debugging and code-completion.</p>
<p>Another improvement is the ability to do glassfish-dirctory-deployment of EARs out of NetBeans. For this you need to add an additional target to the build.xml:</p>
<pre class="xml">    &lt;target name="pre-run-deploy"&gt;
        &lt;unzip dest="${build.dir}" src="${dist.jar}"&gt;
            &lt;patternset includes="${ee.archives}"/&gt;
        &lt;/unzip&gt;
        &lt;mkdir dir="${build.generated.dir}/tmp"/&gt;
        &lt;!--touch file="${build.generated.dir}/unzipee.txt"/--&gt;
        &lt;echo file="${build.generated.dir}/tmp/UnzipEE.java"&gt;&lt;![CDATA[
            package tmp;

            import java.io.File;
            import java.util.Iterator;
            import org.apache.tools.ant.BuildException;
            import org.apache.tools.ant.Task;
            import org.apache.tools.ant.taskdefs.Expand;
            import org.apache.tools.ant.types.FileSet;
            import org.apache.tools.ant.types.Resource;
            import org.apache.tools.ant.types.resources.FileResource;

            public class UnzipEE extends Task {

                private FileSet fileSet;

                public void add(FileSet fileSet) {
                    this.fileSet = fileSet;
                }

                public void execute() throws BuildException {
                    for(Iterator it = fileSet.iterator(); it.hasNext();) {
                        Resource resource = (Resource) it.next();
                        if(resource.isExists() &amp;&amp; (resource instanceof FileResource)) {
                            File file = ((FileResource) resource).getFile();
                            String name = file.getName();
                            String dest = name.replaceAll("\\.jar", "_jar").replaceAll("\\.war", "_war");
                            Expand expand = new Expand();
                            expand.setProject(getProject());
                            expand.setSrc(file);
                            expand.setDest(new File(file.getParentFile(), dest));
                            expand.execute();
                        }
                    }
                }

            }
        ]]&gt;
        &lt;/echo&gt;
        &lt;javac debug="true" srcdir="${build.generated.dir}" destdir="${build.generated.dir}"/&gt;
        &lt;taskdef name="unzipee" classname="tmp.UnzipEE" classpath="${build.generated.dir}"/&gt;
        &lt;unzipee&gt;
            &lt;fileset dir="${build.dir}" includes="${ee.archives}"/&gt;
        &lt;/unzipee&gt;
        &lt;delete dir="${build.dir}" includes="${ee.archives}"/&gt;
        &lt;delete includeemptydirs="true"&gt;
            &lt;fileset dir="${build.dir}" includes="**/.svn" defaultexcludes="false"/&gt;
        &lt;/delete&gt;
        &lt;delete dir="${build.generated.dir}/tmp"/&gt;
    &lt;/target&gt;</pre>
<p>This looks really weird, but is necessary if you want to reference some projects directly and use compile on save. You have to extract all ejb-jars and wars manually into the folder dist/gfdeploy. For this reason the updated plugin generates the property &#8220;ee.archives&#8221;, which is a space separated list of all dependencies of type &#8220;ejb&#8221; or &#8220;war&#8221;. If you want to reference a web-project directly, instead of a war, you have to remove the war-dependency and add the project instead.</p>
<p>The patch for Peter&#8217;s plugin can be found here: <a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=2667507&amp;group_id=162983&amp;atid=825943">SourceForge.net: JTrac: Detail: 2667507</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/frankcaputo.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/frankcaputo.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/frankcaputo.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/frankcaputo.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/frankcaputo.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/frankcaputo.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/frankcaputo.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/frankcaputo.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/frankcaputo.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/frankcaputo.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/frankcaputo.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/frankcaputo.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/frankcaputo.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/frankcaputo.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=frankcaputo.wordpress.com&amp;blog=6840575&amp;post=1&amp;subd=frankcaputo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://frankcaputo.wordpress.com/2009/03/05/update-for-peter-thomas-maven-antprops-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d5cc42fa9a17faf8004d058d9abc9fbb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">frankcaputo</media:title>
		</media:content>
	</item>
	</channel>
</rss>
