Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save acreeger/910438 to your computer and use it in GitHub Desktop.
Save acreeger/910438 to your computer and use it in GitHub Desktop.
Code that you can add to your app's BuildConfig to enable you to specify in-place plugins outside of source controlled files
def buildConfigFile = new File("${userHome}/.grails/${appName}-buildConfig.groovy")
if (buildConfigFile.exists()) {
println "Processing external build config at $buildConfigFile"
def slurpedBuildConfig = new ConfigSlurper().parse(buildConfigFile.toURL())
slurpedBuildConfig.grails.plugin.location.each { k, v ->
if (!new File(v).exists()) {
println "WARNING: Cannot load in-place plugin from ${v} as that directory does not exist."
} else {
println "Loading in-place plugin $k from $v"
grails.plugin.location."$k" = v
}
if (grailsSettings.projectPluginsDir?.exists()) {
grailsSettings.projectPluginsDir.eachDirMatch(~/${k}.*/) {dir ->
println "WARNING: Found a plugin directory at $dir that is a possible conflict and may prevent grails from using the in-place $k plugin."
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment