Grails 3.2.9 custom plugin dependencies

70 views
Skip to first unread message

gaba...@ncsu.edu

unread,
May 30, 2017, 8:19:00 PM5/30/17
to Grails Dev Discuss
Is it possible to make one custom plugin in Grails 3 dependent on another custom plugin? Here's my project structure:

 - grails3-home
    * myApp
    - customPlugin1
        * build.gradle
        * settings.gradle
    - customPlugin2 ...

I would like to make customPlugin1 dependent on customPlugin2. Everything I've read says this possible with multi-project builds between apps and plugins in Grails 3. And I'm able to declare both plugins as dependencies in myApp with no issues. However, I have not been successful in getting this to work between the two plugins.  

I have added the following line to customPlugin1 > settings.gradle

   
include "customPlugin2"


And to customPlugin1 > build.gradle

   
grails {
    plugins
{
        compile project
(':customPlugin2')
   
}
}



However when I try to build customPlugin1, I get the following error:

FAILURE: Build failed with an exception.
  • What went wrong:
A problem occurred configuring root project 'customPlugin1'.
Could not resolve all dependencies for configuration ':runtime'.
Project : declares a dependency from configuration 'compile' to configuration 'default' which is not declared in the descriptor for project :customPlugin2.

Is anyone aware if what I'm trying to do is possible, and if so, what I might be missing?

**Update:**
If I change my configuration to 
   
include "../customPlugin2"

and

grails {
    plugins
{
        compile project
(':../customPlugin2')
   
}
}

the plugin builds successfully, but I am no longer able to import domains classes from customPlugin2 into customPlugin1 domains classes

Sergio del Amo Caballero

unread,
Jun 6, 2017, 1:52:20 AM6/6/17
to Grails Dev Discuss
You will probably want to move your settings.gradle in your root project instead of customPlugin1. You should have just one settings.gradle file. 

Include every project inside settings.gradle 

include 'myapp'
include 'customPlugin1
include 'customPlugin2'

to add customPlugin2 as a depdency of customPlugin1

add in customPlugin1 build.gradle

grails {
    plugins {
        compile project(':customPlugin2')
    }
}

We published a Grails Multi-Project Build which may be helpful: 


regards,
Sergio del Amo
Reply all
Reply to author
Forward
0 new messages