Reputation: 51
I am using grails 2.3.7, in windows.
I want to develop a grails-plugin schedulePlugin which should work with another grails plugin dbPlugin
My Build config for schedulePlugin
grails.project.dependency.resolver="ivy"
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment to disable ehcache
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
legacyResolve true // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
mavenRepo 'http://repo.spring.io/milestone'
}
dependencies {
}
plugins {
runtime ':hibernate:3.6.10.10'
build(
":tomcat:7.0.50.1",
":release:2.2.1",
":rest-client-builder:1.0.3") {
export = false
}
//Own
compile ":grails-dbPlugin:2.0-A6"
}
My Build config for dbPlugin
grails.project.dependency.resolver = "maven" // or ivy
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment to disable ehcache
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
mavenRepo "http://repo.grails.org/grails/libs-releases/" //Added this repo to resolve plugin dependencies for hibernate, joda, zk & quartz.
mavenRepo 'http://repo.spring.io/milestone'
}
dependencies {
}
plugins {
compile ":audit-logging:1.0.1"
compile ":database-migration:1.3.8"
runtime ":hibernate:3.6.10.10"
build(":release:3.0.1"
,":rest-client-builder:1.0.3"
,":tomcat:7.0.50.1") {
export = false
}
}
}
when i compile schedulePlugin, it give me compilation error
| Error Compilation error: startup failed:
C:\projects\scheduler\target\work\plugins\dbPlugin-2.0-A6\grails-app\migrations\init-changelog.groovy: 1: unable to resolve class liquibase.statement.core.
@ line 1, column 1.
import liquibase.statement.core.InsertStatement
I can resolve the error if i add the compile ":database-migration:1.3.8" to BuildConfig of schedulePlugin
But shouldnt it be automatically inherit the dependencies of dbPlugin . Can some one assist with how the dependency should be resolved in this case
Thanks
Upvotes: 1
Views: 871
Reputation: 1
Geolocation plugin has a runtime dependency in its BuildConfig.groovy
runtime 'com.javadocmd:simplelatlng:1.0.0'
You can check the source code here
Now simply add this in your dependencies clause of your app and it will work.
Upvotes: 0
Reputation: 116
It looks like you run into the same problem as I did. It looks to me like the problem originates from the fact that your app uses the "ivy" resolver whereas the plugin uses the "maven" resolver.
See also: Using Grails plugins that use "maven" dependency resolver in a Grails app that uses "ivy"
Upvotes: 0
Reputation: 358
You declare formal plugin dependencies in the plugin descriptor file. For example, if my plugin was named arkDashboard, then the descriptor file is ArkDashboardGrailsPlugin.groovy in the root of my plugin project. Here is an example of a dependency declaration for another plugin named "arkCore":
// Plugins that we are dependent on
def dependsOn = [
"arkCore": "1.2.2 > *"
]
The descriptor file should already be in your plugin project (created by Grails) with this section already stubbed out. You just need to fill it in. See the Plugins section of the manual for details on plugin dependency resolution.
It is a little confusing because you can "fix" the dependencies with explicit rules in the BuildConfig.groovy file, but your instincts are correct and you should leave it to dependency resolution if you can. It makes the code less brittle.
Upvotes: 1