<?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/"
	>

<channel>
	<title>Sword Systems &#187; groovy plugin</title>
	<atom:link href="http://swordsystems.com/category/groovy-plugin/feed/" rel="self" type="application/rss+xml" />
	<link>http://swordsystems.com</link>
	<description>Cutting Commentary</description>
	<lastBuildDate>Tue, 15 May 2012 14:50:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Running latest Groovy from Maven</title>
		<link>http://swordsystems.com/2011/04/05/running-latest-groovy-from-maven/</link>
		<comments>http://swordsystems.com/2011/04/05/running-latest-groovy-from-maven/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 15:10:15 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[groovy]]></category>
		<category><![CDATA[groovy plugin]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[grails]]></category>

		<guid isPermaLink="false">http://swordsystems.com/?p=126</guid>
		<description><![CDATA[Say you have a groovy-project that you build with maven.  You use the org.codehaus.gmaven:gmaven-plugin to compile your groovy code and run groovy tests without a problem.  Then you add some features or tests that need groovy 1.7.  You add the proper dependency and version to the &#60;dependencies&#62; section of your pom, run your test&#8230; and [...]]]></description>
			<content:encoded><![CDATA[<p>Say you have a groovy-project that you build with maven.  You use the org.codehaus.gmaven:gmaven-plugin to compile your groovy code and run groovy tests without a problem.  Then you add some features or tests that need groovy 1.7.  You add the proper dependency and version to the &lt;dependencies&gt; section of your pom, run your test&#8230; and watch it blow up because the gmaven-plugin defaults to using groovy 1.6.  So you dig around on the web and find references for how to use the &lt;providerSelection&gt; tag of the gmaven-plugin to get your code compiled with 1.7 and to use 1.7 when running tests.  Things seem good.  Until&#8230;</p>
<p>You add a feature that requires some version of groovy greater than 1.7.4 (the version included with the latest gmaven-plugin, 1.3).  In my case, I used the @Delegate annotation with some inheritance in a test configuration and hit a bug that was fixed in groovy 1.7.6.  No matter what version I used in my dependencies section, my tests were executed under groovy 1.7.4.  I finally came up with the configuration below which let me run with a different groovy.  Note that it made no difference what I included in the dependencies section.  The gmaven-plugin configuration appears to be completely independent of that.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;plugin&gt;
    &lt;groupId&gt;org.codehaus.gmaven&lt;/groupId&gt;
    &lt;artifactId&gt;gmaven-plugin&lt;/artifactId&gt;
    &lt;version&gt;1.3&lt;/version&gt;
    &lt;configuration&gt;
        &lt;providerSelection&gt;1.7&lt;/providerSelection&gt;
        &lt;!-- This is only used if you want to run a groovy script from the command line using maven --&gt;
        &lt;source&gt;${groovy.script}&lt;/source&gt;
    &lt;/configuration&gt;
    &lt;executions&gt;
        &lt;execution&gt;
            &lt;goals&gt;
                &lt;goal&gt;compile&lt;/goal&gt;
                &lt;goal&gt;testCompile&lt;/goal&gt;
            &lt;/goals&gt;
        &lt;/execution&gt;
    &lt;/executions&gt;
    &lt;!-- This block is required in order to make the gmaven plugins use a groovy other than 1.7.4.
     This is independent of the groovy entry in the dependencies section.  This does not affect the class path.

     What is interesting is that there must be both the gmaven.runtime entry with the explicit excludes
     and the additional dependency on whatever version we do want to use.  If you exclude the former,
     it will throw an exception. --&gt;
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.codehaus.gmaven.runtime&lt;/groupId&gt;
            &lt;artifactId&gt;gmaven-runtime-1.7&lt;/artifactId&gt;
            &lt;version&gt;1.3&lt;/version&gt;
            &lt;exclusions&gt;
                 &lt;exclusion&gt;
                     &lt;groupId&gt;org.codehaus.groovy&lt;/groupId&gt;
                     &lt;artifactId&gt;groovy-all&lt;/artifactId&gt;
                 &lt;/exclusion&gt;
            &lt;/exclusions&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.codehaus.groovy&lt;/groupId&gt;
            &lt;artifactId&gt;groovy-all&lt;/artifactId&gt;
            &lt;version&gt;1.7.6&lt;/version&gt;
        &lt;/dependency&gt;
    &lt;/dependencies&gt;
&lt;/plugin&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://swordsystems.com/2011/04/05/running-latest-groovy-from-maven/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eclipe Groovy Plugin &#8211; decent for scripts, PITA for classes</title>
		<link>http://swordsystems.com/2009/05/03/eclipe-groovy-plugin-decent-for-scripts-pita-for-classes/</link>
		<comments>http://swordsystems.com/2009/05/03/eclipe-groovy-plugin-decent-for-scripts-pita-for-classes/#comments</comments>
		<pubDate>Sun, 03 May 2009 20:14:00 +0000</pubDate>
		<dc:creator>eric</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[groovy plugin]]></category>

		<guid isPermaLink="false">http://swordsystems.com/?p=5</guid>
		<description><![CDATA[I have been using the Groovy plugin for Eclipse for about 18 months now. First let me say thanks to the team who has put it together. I can&#8217;t really complain about any problems since it is a volunteer effort and I haven&#8217;t volunteered. And over the time I have used the plugin it has [...]]]></description>
			<content:encoded><![CDATA[<p>I have been using the <a href="http://groovy.codehaus.org/Eclipse+Plugin">Groovy plugin for Eclipse</a> for about 18 months now.  First let me say thanks to the team who has put it together.  I can&#8217;t really complain about any problems since it is a volunteer effort and I haven&#8217;t volunteered.  And over the time I have used the plugin it has gotten some pretty nice improvements, especially for code refactoring and auto-completion.  It&#8217;s debugging capability has always been good (with a few quirks).  The fact that I can debug scripts as well as regular classes kept me from switching to NetBeans when the major upgrade of that product came out in November without that feature (hmmm&#8230; I see there are some upgrades for NB.  Yet another thing to add to my to-do list to check out).  Overall I find the plugin perfectly capable when writing scripts, especially in small projects.  For writing classes however, especially in a large project or when mixed with Java classes, it&#8217;s a PITA.  </p>
<p>For those that cannot or do not want to move from Eclipse to IDEA or NetBeans, here are a few tips for getting by with the plugin for now:</p>
<p>1) The largest issue is a memory leak.  I posted to the <a href=" http://archive.castor.codehaus.org/lists/org.codehaus.groovy.user/msg/47F67363.9010304@saic.com">groovy user list</a> about it over a year ago.  (My explanation of the problem in that post was slightly incorrect.  The problem will occur in any project with a lot of classes on the class path, not just one that includes another project.)  I think the issue has gotten better in some circumstances, but it still makes it impossible for me to easily integrate groovy classes into my major projects.<br /><span style="font-weight:bold;">Work Around:</span> I have a small &#8220;GroovySandbox&#8221; project that has the class directory and key required libraries from my main project on its classpath.  (Do not include the main project as a dependent project because you will have the exact same memory problem.) I write new scripts and classes in this project and then when they are ready, I copy them into the main project.  The memory issue still has an affect, but I can work a full day on groovy files without having to restart eclipse rather than having to restart every 20-30 minutes.</p>
<p>2) Whenever I modify the class path of a project that includes groovy classes (thus triggering a clean build by Eclipse), the groovy class files are wiped with everything else and are not regenerated.  I have to go in and touch each groovy class to get it to compile.<br /><span style="font-weight:bold;">Work Around:</span> I now have enough groovy classes that this isn&#8217;t feasible, so I created an ant target that compiles only the groovy classes and I trigger it from within Eclipse when necessary.  Eclipse detects the newly generated class files and the remaining java classes I have that are dependent on the groovy classes finish compiling.  (Why do I have to mix groovy and java so much?  See #1, above and #3, below.  Unless I want to take advantage of groovy syntax features a lot, I stick with Java.) </p>
<p>3. When I open a groovy class in the editor, it often doesn&#8217;t populate the Outline view.  Makes it hard to navigate the file.<br /><span style="font-weight:bold;">Work Around:</span> Touch the file, or add-and-delete a space.  This was a pain when using CVS for our SCM since the files were  tagged as modified, but since switching to Subversion there hasn&#8217;t been a problem.  I guess Subversion uses something beyond file dates to track mods.</p>
<p>4. When debugging, if I try to step into a class (java or groovy) that is included from another project (which I do frequently since nearly all classes are in the main project due to #1, above), I get an error window saying that the class is part of the Groovy Libraries plugin path and that the path is not modifiable.  The screen doesn&#8217;t give you a button to modify the source lookup path for the directory/jar. (This one is relatively new.  It started happening in some update around the beginning of the year.)<br /><span style="font-weight:bold;">Work Around:</span> Go into the project properties->Java Build Path->Libraries and manually set the &#8220;Source Attachment&#8221; property for the offending directory/jar.  The next time you start the debugger, it will let you step in without a problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://swordsystems.com/2009/05/03/eclipe-groovy-plugin-decent-for-scripts-pita-for-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

