开发者

Grails - Reference Plugin Jar from the plugin's BuildConfig.groovy (Custom Resolver)

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 poi开发者_开发知识库nt 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜