Search code examples
grailsquartz-schedulergrails-plugindependency-managementshiro

How to resolve grails plugins dependencies


My grails app should work with two plugins: shiro and quartz2.

I'm add both of plugins to BuildConfig.groovy:

  • compile ":shiro:1.1.4"
  • compile ":quartz2:2.1.6.2"

(after that ide downloaded them)

The problem in dependencies: shiro depends from shiro-quartz:1.2.0 and shiro-quartz from org.opensymphony.quartz 1.6.1

I wonder why but quartz2 looking for methods implementation to quartz-1.6.1.jar. Quartz2 cannot find implementations and that's why project cannot be build. I think quartz2 should search methods implementations in "normal" quartz lib, like quartz:1.0-RC7, but he do not.

So, how can i solve shiro and quartz2 plugins conflict?

I heard about dependency excluding, but i not sure about this sugesstion.

P.S. with quartz(not quartz2) the same problem occurred


Solution

  • You can run dependency-report to check what dependencies the plugins are trying to add to your project. The problem seems to be that shiro-quartz depends on quartz 1.x and quartz plugin uses quartz 2.x.

    Normally you could do:

    compile (":shiro:1.1.4") {
      excludes('org.opensymphony.quartz:quartz')
    }
    

    But there's a bug, and this transitive dependency isn't excluded. There's an open ticket to adjust this.

    The good thing is that there's a workaround:

    compile (":shiro:1.1.4") {
      excludes([name: 'quartz', group: 'org.opensymphony.quartz'])
    }
    

    With this, Grails will use Quartz 2.x only.