1

The Problem: I've built a custom grails plugin, defined my dependencies on other plugins via BuildConfig.groovy and packaged my plugin into a zip file. I then added the zip to my local maven repository and all is well. The file dependencies.groovy within the zip has my dependent plugin entries as it should. Example:

grails.project.dependency.resolution = {
   inherits 'global'
   log 'warn'
   repositories {
      grailsCentral()
   }
   dependencies {
      // runtime 'mysql:mysql-connector-java:5.1.5'
   }
   plugins {
      build(':release:2.0.4', ':rest-client-builder:1.0.2') {
         export = false
      }
      compile ":rest:0.7"      // #1 plugin I'm dependent upon
      compile ":fields:1.3"    // #2 plugin I'm dependent upon
   }
}

When I add the plugin as a compile dependency within another project (within eclipse, via the BuildConfig.groovy file), and refresh my grails dependencies, the plugin is installed but the plugins my plugin is dependent on are not installed (dependencies.groovy is ignored).

I've seen this problem posted over and over and no one provides a real solution. Has anyone found a fix for this problem?

tim_yates
  • 167,322
  • 27
  • 342
  • 338
rittinger
  • 41
  • 2
  • "dependent on are not installed" How did you checked it? I have all my custom plugins installed in a local maven and it works. –  Aug 15 '13 at 17:34
  • The same question has popped thrice in two days. [Tested and answered a similar question](http://stackoverflow.com/a/18244262/2051952) yesterday, everything looks fine. – dmahapatro Aug 15 '13 at 17:42
  • Not sure I understand. If you look at the code above, from the dependencies.groovy file for my custom plugin, you can see I am dependent upon the 'rest' and 'fields' plugin. When my plugin is installed within my main app, I get a compilation error because rest can not be found. The file dependencies.groovy is being ignored (as far as the rest and fields plugins go). – rittinger Aug 15 '13 at 18:11
  • I also tried running: grails dependency-report Within the report it shows my plugin having NO dependencies even though dependecies.groovy shows I need the rest and fields plugin. I'm new to groovy/grails and I assume I made a mistake in on of my files somewhere?!?! – rittinger Aug 15 '13 at 18:14
  • My guess is that you're using and older version of your plugin, maybe some cache? Try to change your plugin version and do the maven-install again. –  Aug 15 '13 at 19:01
  • I've "mavenized" the plugin and application projects within eclipse. When I look at the dependency hierarchy for the plugin, I see the 'rest' and 'fields' plugin as expected. When I view the dependency hierarchy for the application (which uses my plugin), I see my plugin listed but I do not see the 2 plugins I'm dependent upon (rest and fields). Maven should be figuring this out dynamically right? – rittinger Aug 19 '13 at 17:36
  • 1
    Here are my final findings: - if you use inline dependencies in BuildConfig, the dynamic scaffolding my plugin provides is not copied into my app. Fail. - if you install the plugin into Maven without the option -DpomFile, and use "pom true" in buildconfig, the scaffolding is copied but transitive dependencies are not resolved. - To fix, make sure to include your plugin pom.xml file when you perform the mvn install. Everything works. - You must let the pom manage your dependencies. Using BuildConfig alone will not resolve transitive dependencies EVEN IF dependencies.groovy is present inzip – rittinger Sep 20 '13 at 13:30

0 Answers0