Archive for the Category 'grailsplugin'

This Week in Grails (2013-04)

Sunday, February 03rd, 2013

Greach was this week and it was great. It was my first time visiting Spain, so that was an added bonus. The Spanish Groovy and Grails community is apparently thriving, and the attendance was about the same as Groovy & Grails Exchange and GR8Conf, if not higher. There are already some blog posts up and several speakers have put their slides online:

The Groovy team released Groovy 2.1 this week (and made the announcement live during Cedric’s keynote at Greach). Groovy now has full support for invokedynamic, which promises huge performance increases. Note that the 2.1 release notes currently don’t describe how to use the “indy” jars; see the 2.0 release notes for that information.

Andre Steingress released a few blog posts describing some new features in 2.1:

Gradle 1.4 was released this week. There is a description of the plans for 1.5 here, and you can see a short video overview of the 1.4 highlights here.

Marc Palmer’s resources plugin Kickstarter is now live. Nearly everything you use for Grails development is free (except for IntelliJ Ultimate if that’s your IDE of choice) but real people do the work to provide you with Grails and the plugins and tools you use daily. It would be great if we were all paid to do this work (I’m very lucky that I am) but we’re not. The project us currently funded at 10% so contribute soon.

Cedric Champeau’s talk on type checking extensions at Greach was very interesting, and he’s added some documentation for the feature. Check out his slides and the video of the talk when it’s available.

There are only two weeks left to submit talks for the EU and US GR8Conf conferences – the deadline is February 15th.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were no new plugins but 18 updated plugins:

  • audit-trail version 2.0.3. Adds created/updated audit fields to domain classes and updates them after a new insert or update
  • backbonejs version 0.9.10.3. Provides resources for Backbone.js http://backbonejs.org/
  • coffeescript-compiler version 0.6. Compiles .coffee source files into .js files
  • cxf-client version 1.5.0. Use existing (or new) Apache CXF wsdl2java generated content to invoke SOAP services
  • dojo version 1.6.1.16. Integrates the Dojo javascript toolkit
  • ember-templates-precompiler version 0.3.0. Precompiles EmberJS powered Handlebars templates
  • events-si version 1.0.M5. Standard Events system for Grails implementation; it is a Spring Integration implementation and uses its artefacts to map listeners, senders and events messages
  • feature-switch version 0.6. Allows turning on and off of features
  • flash-helper version 0.9.5. Simplifies and standardizes the process of adding/reading messages in the flash scope
  • font-awesome-resources version 3.0. Integrates the Font Awesome icon set
  • html5-mobile-scaffolding version 0.5. Scaffolds HTML5 mobile application using jQuery mobile in a single page
  • jetty version 2.0.2. Makes Jetty the development time container
  • lesscss-resources version 1.3.1. Optimises the use of http://www.lesscss.org css files, compiling .less files into their .css counterprt, and place the css into the processing chain to be available to the other resource plugin features
  • quartz2 version 2.1.6.2. Integration with Quartz 2 framework from quartz-scheduler.org
  • spring-security-facebook version 0.11. Plugin for Facebook Authentication, as extension to Grails Spring Security Core plugin
  • underscore version 1.4.3. Simple plugin wrapper for useful Underscore.js library
  • vaadin version 1.7.0-rc2. Adds Vaadin (http://vaadin.com/) integration
  • yammer-metrics version 2.1.2-4. Packages Coda Hale’s yammer metrics jars

Interesting Tweets

Jobs



User groups and Conferences

This Week in Grails (2013-03)

Tuesday, January 22nd, 2013

The Groovy team announced the second release candidate for Groovy 2.1.0 this week, and they’ve already released RC3 since then. This should be the final RC before 2.1.0 final.

The Griffon team released version 1.2.0 this week.

Marc Palmer is doing some interesting experiments with paid Grails plugin development, maintenance and documentation. He’s testing the waters with an e-book for the email-confirmation plugin, and is looking into how interested people are in a book on the resources plugin. And he should have a KickStarter campaign going soon to fund the development effort to clear the backlog of bugs and feature requests for the resources plugin. It’ll be interesting to see if the historically cheap Java-based community will be willing to dig into their wallets 🙂

Greach is this week, it will be Friday and Saturday in Madrid. Tickets are still available. Two tracks, a great lineup of speakers, Madrid. What more could you ask for?

The call for papers for the two GR8Conf conferences ends in a few weeks on February 15th. Get those talk proposals submitted, here for the EU conference and here for the US conference.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 3 new plugins released:

  • coffeescript-compiler version 0.5. Compiles .coffee source files into .js files
  • excel-export version 0.1.3. Export data in Excel (xlsx) format using Apache POI
  • hsoy-templates version 0.3. Adds support for Hsoy Templates (Google Closure Templates with HAML syntax)

and 21 updated plugins:

  • airbrake version 0.9.2. Notifier plugin for integrating apps with Airbrake
  • akka version 0.6.2. Akka actors integration from Groovy and Java, in a Servlet 3.x environment
  • asynchronous-mail version 1.0-RC3. Send email asynchronously by storing them in the database and sending with a Quartz job
  • atmosphere version 1.1.0.beta2. Provides integration with the Atmosphere project, a portable AjaxPush/Comet and WebSocket framework
  • easygrid version 1.2.1. Provides a convenient and agile way of defining Data Grids
  • email-confirmation version 2.0.8. Sends an email to a user with a link to click to confirm site registration
  • events-push version 1.0.M7. A client-side event bus based on the portable push library Atmosphere that propagates events from the server-side event bus to the browser
  • feature-switch version 0.5. Allows turning on and off of features
  • functional-test-development version 0.9.4. Installs a script, develop-functional-tests, that you can use to develop your functional tests more conveniently
  • handlebars-resources version 0.3.5. Supports using Handlebars.js templates with the Grails Resources Plugin
  • jquery version 1.9.0. Integrates jQuery
  • mail-on-exception version 0.1.1. Allows one to specify an email address where all frontend exceptions will be sent
  • newrelic version 0.6. Adds the NewRelic Real User Monitoring feature to your GSP pages
  • plastic-criteria version 0.5. Mock Grails Criteria for Unit Tests
  • platform-core version 1.0.RC5. Provides functionality for plugins to use to achieve greater integration with each other and with applications
  • raven version 0.5.3. Sentry Client for Grails
  • remote-control version 1.4. Execute code inside a remote Grails application
  • sanitizer version 0.8.0. Sanitizes markup(HTML, XHTML, CSS) using OWASP AntiSamy Filters
  • spring-security-facebook version 0.10.4. Plugin for Facebook Authentication, as extension to Grails Spring Security Core plugin
  • vaadin version 1.7.0-rc1. Adds Vaadin (http://vaadin.com/) integration
  • xwiki-rendering version 1.0-RC2. Convert texts using XWiki Rendering Framework

Interesting Tweets

Jobs



User groups and Conferences


This Week in Grails (2013-02)

Thursday, January 17th, 2013

Graeme wrote about the new Aether-based depedency resolution approach in 2.3. Aether is missing a few features that Ivy has but makes up for that in several ways, in particular by being significantly faster.

The Groovy team released an RC of Groovy 2.1. Lots of cool stuff there, the most interesting to me being support for invokedynamic. This promises to bring huge performance increases without any annotations or code changes (as long as you’re using a JDK version that supports it).


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were no new plugins released but 11 updated:

  • asynchronous-mail version 1.0-RC1. Send email asynchronously by storing them in the database and sending with a Quartz job
  • clover version 3.1.10.1. Integrates the Clover code coverage tool
  • cookie-session version 2.0.3. Allows you to store session data in a cookie
  • cucumber version 0.8.0. Test your Grails apps with Cucumber
  • easygrid version 1.1.0. Provides a convenient and agile way of defining Data Grids
  • kissmetrics version 0.2.0. Allows your Grails application to use KISSmetrics APIs
  • localizations version 1.4.4.7. Store i18n strings in a database
  • quartz version 1.0-RC5. Schedules jobs to be executed with a specified interval or cron expression using the Quartz Enterprise Job Scheduler
  • remote-pagination version 0.4.1. Provides tags for pagination and to sort columns without page refresh using Ajax and loads only the list of objects needed
  • slug-generator version 0.2. Generates unique slugs for String properties, for example to generate unique ‘nice’ urls for access to domain objects
  • vero version 0.2.0. Allows your Grails application to use Vero APIs

Interesting Tweets

User groups and Conferences


This Week in Grails (2013-01)

Thursday, January 10th, 2013

The big news of this week is that there is finally a book available that covers Grails 2, Jeff and Graeme’s The Definitive Guide to Grails 2. There’s even photographic proof that it’s shipping 🙂

If you’re considering submitting talk proposals to either or both of GR8Conf Europe and GR8Conf US be sure to do so soon; the deadline is February 15. Submit for the US conference here and the EU conference here, and if you want to submit for both you can do that from either site.

I released two new plugins this week. The first was the database-migration-jaxb plugin which was going to be part of the database-migration plugin but it requires Java 7 or higher (more specifically JAXB 2.2 or higher) so I released it as an addon instead. It adds a new approach to creating database migrations – writing them programmatically using JAXB-generated classes. I wrote about this and the big new 1.3 release of the database-migration plugin in this blog post.

The other new plugin is spring-security-shiro which adds the ability to use Shiro’s easy and powerful ACLs and permissions alongside Spring Security and the spring-security-core plugin. See this blog post for more information.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 2 new plugins released:

and 13 updated plugins:

  • akka version 0.6.1. Akka actors integration from Groovy and Java, in a Servlet 3.x environment
  • browser-detection version 0.4.3. Provides a service and tag library for browser detection
  • database-migration version 1.3.2. Official Grails plugin for database migrations
  • equals-hashcode-test version 0.3. Base Spock specification for testing equals and hashCode methods of domain classes and other Groovy objects
  • facebook-sdk version 0.4.8. Allows your application to use the Facebook Platform and develop Facebook apps on Facebook.com or on web sites (with Facebook Connect)
  • grom version 0.3.0. Sends notifications on Windows, Linux, and Mac
  • handlebars-resources version 0.3.4. Supports using Handlebars.js templates with the Grails Resources Plugin
  • newrelic version 0.5. Adds the NewRelic Real User Monitoring feature to your GSP pages
  • quartz-monitor version 0.3-RC1. One clear and concise page that enables you to administer all your Quartz jobs
  • remote-pagination version 0.4. Provides tags for pagination and to sort columns without page refresh using Ajax and loads only the list of objects needed
  • spring-security-facebook version 0.10.3. Plugin for Facebook Authentication, as extension to Grails Spring Security Core plugin
  • stripe version 1.3. Use Stripe to process credit card transactions
  • war-exec version 1.0.2. Makes the war files generated by Grails executable (java -jar myapp.war) by embedding Jetty. Jetty can be configured using properties in Config.groovy

Interesting Tweets

User groups and Conferences


A Grails plugin to bridge Spring Security and Shiro

Sunday, January 06th, 2013

I started using Spring Security in 2007 when I was tasked with adding security to a Spring/Hibernate application at the company I was working for. There were a few options to choose from, none of them particularly friendly to work with, and we chose Acegi Security because it was the most popular option for Spring applications. My experience was like that of many others – it was confusing and frustrating, and required a ton of XML. The next major release was renamed Spring Security 2.0 and it was officially brought in as a Spring subproject, and fortunately it made configuration dramatically simpler by using Spring XML namespaces.

When I started using Grails and found that it supported plugins one of the first I looked at was the acegi plugin, and I eventually became the plugin maintainer and later wrote most of the newer Spring Security plugins. I keep working with Spring Security because it’s very powerful and because I know it well, having struggled with learning Acegi 1.0.x, and then moving on to Spring Security 2.x and 3.x.

Grails has another popular security plugin, the shiro plugin. I haven’t used it but it has the reputation that it’s easier to use than Spring Security. I think that’s less the case with the plugins since spring-security-core and its dependent plugins are quite user-friendly, but more so when you’re not using the plugins or are working directly with the underlying APIs. For the most part the feature set of Spring Security and Shiro overlap with Spring Security having a few more features (but Shiro is catching up quickly). But one feature that is strangely implemented and hard to use in Spring Security but easy to use in Shiro is ACLs and permissions.

It took me a long time to get the spring-security-acl plugin finished, in large part because the Spring Security ACL implementation is overly complicated and hard to use. It works, but it’s far from user-friendly. But looking at the Shiro plugin’s documentation I was jealous to see that you can do simple things like grant the “printer:print:*” permission to a user, and the wildcard implies the “printer:print:lp7200” and “printer:print:epsoncolor” permissions. Then you can guard a service method with @RequiresPermissions('printer:print:*) and a user granted “printer:print:*” (or a more specific permission like “printer:print:lp7200”) can call the method, and others will be denied.

A while back I thought it would be cool to be able to use Shiro’s permission support in addition to Spring Security. I started working on it a few months ago and picked it up again this weekend and got it working. Basically it just adds a filter that runs after the Spring Security SecurityContextPersistenceFilter which populates the SecurityContext (typically from the HTTP session) with your current Authentication, and creates a Shiro Subject with the same information and registers it in the ThreadContext. In addition it adds support for storing permission information. This is done by default with a domain class that has a many-to-one relationship with the existing user class, but this is customizable.

So now you can install the spring-security-shiro alongside the spring-security-core and any of its dependent plugins and use both approaches. You can even use Spring Security ACLs and Shiro ACLs at the same time.

Check out the plugin page and the documentation for more information.

Updated Grails Database Migration plugin

Friday, January 04th, 2013

Edit: January 5 – I released the plugin that adds support for JAXB-based classes; see the plugin page and the documentation for more information.


One of the downsides to releasing a lot of plugins is lots of reported issues. I’ve joked that since there aren’t good ways to know how much use a plugin gets, the best metric is the number of reported bugs and feature requests, and that is mostly true. Using that logic the database-migration plugin is very popular 🙂

I try to address serious issues, but most of this plugin’s issue have to do with generated code. My attitude towards generated code is that it should not be trusted, and should rarely be expected to be completely correct. For example, when you use the dbm-gorm-diff or dbm-generate-gorm-changelog scripts, they do most of your work for you. My hope is that it saves you lots of time and that you shouldn’t need to do much work to fix any issues, but that you should expect issues.

When I did the What’s new with Grails 2.0 talk at NEJUG a year ago I mentioned this plugin and focused on the GORM-based scripts because I think they’re the best approach to creating migrations. But one of the attendees who also uses Rails said that Rails migrations were better because they have a DSL that you can use to write the migrations. I realized that I was so used to running dbm-gorm-diff that I had neglected to even mention the extensive Groovy DSL that the plugin supports (it’s a 100% clone of the XML syntax in native Liquibase). It’s a good DSL and you can create migrations completely by hand using it, but I can’t see why you would do that given how much you can get for free with the scripts. I mention this story to point out why I think it’s ironic when people complain that it’s tedious to have to fix invalid code that a script generated; feel free to use the DSL directly and forego the broken scripts 😉


The bug list for the database-migration plugin was getting a bit big and there were quite a few open pull requests. The tipping point however was seeing this tweet and realizing that I should spend some time on the plugin again.

The pull request that Zan mentioned in his tweet was a big one, adding support for doing migrations on multiple databases, mirroring the multi-datasource support in Grails 2.0. It would be great if all pull requests were this high-quality, including documentation updates and lots of tests. While I was integrating that (I had made some changes since then that required a traditional pull request since the Github UI wouldn’t do an automatic merge, and there were a few conflicts) I worked on the other outstanding issues.

I merged in all of the open pull requests – many thanks for those. I also closed a few bugs that weren’t real bugs or were duplicates, and fixed several others. That made for an interesting JIRA 30-day issue graph:

Many of the other reported issues were variants of the same problem where Liquibase was specifying the size of database columns that don’t support a size (for example bytea(255)). Hibernate does a much better job of this, so I was able to rework things so the Hibernate data types are used where possible instead of what Liquibase generates. So hopefully the generated changelogs will be much more accurate and involve less tweaking.

You can see the release notes of the 1.3 release here and the updated docs here.

Note that the latest version of the plugin is 1.3.1 since there were issues with the JAXB code that I included in the 1.3 release. I removed the code since it depends on Java 7 (and wasn’t completely finished) and will release it as a separate plugin.

This Week in Grails (2012-52)

Wednesday, January 02nd, 2013

Tomas Lin published a great blog post with a large collection of Grails testing resources.
Be sure to register your support for Marc Palmer’s proposed book on the resources plugins.

The Greach conference is getting closer, only a few weeks away. Do you have your ticket yet?

I released a new plugin this week, the lazylob plugin. It adds support for lazy loading of BLOB and CLOB domain class properties so you don’t have to artificially split your domain class into a one-to-one just to avoid the cost of loading large object data when you load domain class instances.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There was 1 new plugin released:

  • lazylob version 0.1. Adds support for lazy-loaded Blobs and Clobs

and 3 updated plugins:

  • quartz version 1.0-RC4. Schedules jobs to be executed with a specified interval or cron expression using the Quartz Enterprise Job Scheduler
  • spring-security-taobao version 1.1. Integrates the Taobao Open API Authentication with the Spring Security Core plugin
  • zk version 2.1.0. Adds ZK Ajax framework (www.zkoss.org) support to Grails applications

Interesting Tweets

User groups and Conferences


This Week in Grails (2012-51)

Thursday, December 27th, 2012

There were a few Groovy and Grails releases this week. Grails 2.2 was released and there are many new features but the big one is that it uses Groovy 2.0. Grails 2.1.3 was also released and includes fixes for the 2.1.x line.

Groovy 2.0.6 was released with several fixes and improvements, and the first beta of Groovy 2.1 was released. It looks like 2.1 will have some very interesting new features.

Also, GPars 1.0 was released this week.

There were a few writeups about the Groovy & Grails Exchange last week:

and a few more interesting tweets:

I forgot to mention when discussing GGX last week that Yu Sudo took some great photos during the conference. While the rest of us were using our cell phones to take mediocre shots (and often making them worse with Instagram filters) he was using a real camera. I didn’t know people still used real cameras 🙂 Check out his stuff on Flickr.

I updated my old Spring MVC plugin this week and wrote up why you would use it here. I also released a new plugin that adds support for Logback.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 4 new plugins released:

  • crash version 1.2.0-cr3-p1. Integrates the Common Reusable SHell (CRaSH – http://crashub.org/ )
  • logback version 0.1.1. Replaces Log4j with Logback for logging
  • miniprofiler version 0.1. Shows timing and SQL query information in a head-up display in a web page; useful for debugging database and other performance problems
  • grails-remote-methods version 0.2. Allow controller methods to call from JS without any code

and 15 updated plugins:

  • aws-sdk version 1.3.26. Use the Amazon Web Services infrastructure services
  • codenarc version 0.18. Static code analysis for Groovy
  • cucumber version 0.7.0. Test your Grails apps with Cucumber
  • facebook-sdk version 0.4.7. Allows your application to use the Facebook Platform and develop Facebook apps on Facebook.com or on web sites (with Facebook Connect)
  • jasper-response version 1.0.1. Render JasperReports as PDF or HTML
  • kickstart-with-bootstrap version 0.8.9. Start your project with a good looking frontend, with adapted scaffolding templates for standard CRUD pages using Twitter Bootstrap
  • mongodb version 1.1.0.GA. Aims to provide an object-mapping layer on top of MongoDB
  • oauth version 2.2.1. Provides easy interaction with OAuth service providers
  • quartz version 1.0-RC3. Schedules jobs to be executed with a specified interval or cron expression using the Quartz Enterprise Job Scheduler
  • sendgrid version 1.1. Allows the sending of Email via SendGrid’s services
  • spring-security-facebook version 0.10.2. Plugin for Facebook Authentication, as extension to Grails Spring Security Core plugin
  • spring-security-twitter version 0.4.4. Twitter authentication as extension to the Spring Security Core plugin
  • springmvc version 0.2. Enables the use of Spring MVC controllers
  • vaadin version 1.7.0-beta11. Adds Vaadin (http://vaadin.com/) integration
  • zkui version 0.5.5.2. Seamlessly integrates ZK with Grails’ infrastructures; uses the Grails’ infrastructures such as GSP, controllers rather than zk’s zul as in ZKGrails plugin

Interesting Tweets

User groups and Conferences


Grails plugin dependencies

Wednesday, December 19th, 2012

If you need a jar library in a Grails plugin, the best approach is to add a dependency in BuildConfig.groovy from a Maven repository so you (and your users) only download it once and use it for each project that needs it. This works well as long as the jar is in Maven Central or some other repo, but some smaller projects don’t publish to Maven repos, so sometimes you are stuck with jar files in the lib directory. Using dependency management is convenient, especially since you can override the version in the application later if a newer jar version is released.

The standard syntax is simple, for example

dependencies {
   compile 'com.atomikos:transactions-jms:3.8.0'
}

This is great, but due to the way Maven works this can result in far more than just that one jar file since all of its dependencies and transitive dependencies will also be downloaded and added to the project’s classpath. That’s what you want most of the time, but often I’ve found that there are unneccessary depdendencies, or dependencies that are already provided by Grails or another plugin but with a different version. So I tend to list out all of the dependencies that I actually want to end up with, adding the necessary exclusions to the dependency declarations. For example here are the two that the spring-security-core plugin defines:

compile('org.springframework.security:spring-security-core:3.0.7.RELEASE') {
   excludes 'spring-expression', 'spring-core', 'spring-context', 'spring-tx',
            'spring-aop', 'spring-jdbc', 'spring-web', 'spring-test', 'aspectjrt',
            'aspectjweaver', 'cglib-nodep', 'ehcache', 'commons-collections',
            'hsqldb', 'jsr250-api', 'log4j', 'junit', 'mockito-core', 'jmock-junit4'
}

compile('org.springframework.security:spring-security-web:3.0.7.RELEASE') {
   excludes 'spring-security-core', 'spring-web', 'spring-jdbc', 'spring-test',
            'commons-codec', 'hsqldb', 'servlet-api', 'junit', 'mockito-core', 'jmock-junit4'
}

I could have cheated and just used transitive = false:

compile('org.springframework.security:spring-security-core:3.0.7.RELEASE') {
   transitive = false
}

compile('org.springframework.security:spring-security-web:3.0.7.RELEASE') {
   transitive = false
}

but this is really only appropriate for applications; in plugins it’s better to avoid this so the pom files are correct.


This usually isn’t that hard to do; it’s just a matter of reading pom.xml files and copy/pasting the relevant bits. But it can be tedious and I realized recently that this was an excellent use case for a Groovy script.

If you’ve installed the release plugin (it should be there since it’s added to the plugin’s BuildConfig.groovy by default) then you can run the generate-pom and it will generate target/pom.xml.

The process that I use is iterative. The first step is to use the transitive = false attribute that I said not to use earlier. This will generate a pom.xml with all of the dependencies and transitive dependencies enumerated for you for each of your specified dependencies. Then run this script in a Grails or Groovy console and it will build the proper syntax for each declaration:

String xml = new File('/path/to/pom.xml').text
for (dependency in new XmlSlurper().parseText(xml).dependencies.dependency) {
   String scope = dependency.scope ?: 'compile'
   Set exclusions = []
   for (exclusion in dependency.exclusions.exclusion) {
      String groupId = exclusion.groupId
      String artifactId = exclusion.artifactId

      if ( (groupId == 'xml-apis' && artifactId == 'xml-apis') ||
           (groupId == 'xml-apis' && artifactId == 'xmlParserAPIs') ||
           (groupId == 'xerces' && artifactId == 'xmlParserAPIs') ) {
         continue
      }

      exclusions << "'$artifactId'"
   }

   String combined = dependency.groupId.text() + ':' +
       dependency.artifactId.text() + ':' +
       dependency.version.text()
   if (exclusions) {
      println "\t$scope('$combined') {"
      println "\t\texcludes ${exclusions.sort().join(', ')}"
      println "\t}\n"
   }
   else {
      println "\t$scope '$combined'\n"
   }
}

Replace transitive = false with the output from the script. If this is sufficient then you’re done, but if you’ve excluded a jar file that you will need, then add it as an explicit dependency with transitive = false and run the script again. Repeat the process until all of the important jar files are listed, and all of their dependencies are properly excluded. Keep in mind that you don’t have to list everything, just what you need to get your plugin working. If a user needs another related jar that you excluded, it can always be added to the application’s BuildConfig.groovy.


For a more extensive example, see the db-reverse-engineer plugin’s BuildConfig.groovy. I could have just defined a dependency for the Hibernate Tools jar, but to do it correctly I ended up with six dependency declarations.

An updated Grails Spring MVC Plugin

Tuesday, December 18th, 2012

The springmvc plugin was one of the first that I wrote. At the time it wasn’t possible to create controllers in Java, so the plugin added the feature as a way to migrate existing controllers from traditional Spring applications, or to use Java if Groovy performance is an issue. But direct support for annotated controllers was added in Grails 1.2 so that made the plugin redundant.

But I found when describing this feature for the Spring chapter of Programming Grails that all URLs end up with a .dispatch suffix. This has a workaround since you can re-map the URLs in UrlMappings.groovy but it’s not DRY since it has to be done for each URL. I saw this question on Stack Overflow and thought it’d be good to update the plugin since it allows the flexibility of using any URL suffix.

So I updated the plugin to work with Grails 2.0 and higher. See the plugin documentation for installation and configuration information. We’ll get the issues that the plugin addresses fixed in Grails, but that won’t happen until 2.3, so use this until then. You can download a sample application here.

For information on the history of the plugin, see the original post and the plugin announcement.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.