0

I have a plugin that loads a custom Ivy resolver. It uses ${basedir} to locate the jar file containing the resolver so I can load it inside BuildConfig (see the answer for context). That compiles the plugin, but unfortunately, when the plugin is installed in a project,basedir becomes the project directory so it can't find the jar. pluginBasedir doesn't seem to point to anything, even inside the plugin's BuildConfig.groovy.

Is there any way to figure out the plugin base directory from within a plugin's BuildConfig.groovy?

Ultimately I just want my custom resolver (in an external jar) to work when compiling the plugin and when compiling any project the plugin is a part of. Any solution is welcome.

Community
  • 1
  • 1
noah
  • 21,289
  • 17
  • 64
  • 88

1 Answers1

0

The best answer I could come up with was to get my jar into a public Maven repo and use @Grab. e.g.,

@Grab(group='com.noahsloan.atg',module="atg-resolver",version="1.0")
import com.noahsloan.atg.ivy.AtgModuleRepository

grails.project.dependency.resolution = {

    resolver AtgModuleRepository.newResolver

From my plugin. I'd still like to know if there is a way to reference pluginBasedir from BuildConfig.

noah
  • 21,289
  • 17
  • 64
  • 88