2013-05-03 123 views
2

我写了一个定制插件,它取决于Spring-Social Core和Spring-Security Core。我可以在打包的zip文件中的dependencies.groovy中看到下面的定义。Grails 2.1.0插件传递依赖关系

MYCustomPluginBuildConfig: 
plugins { 
     build(":tomcat:$grailsVersion") 
     compile(":spring-security-core:1.2.7.3") 
     compile(":spring-social-core:0.1.31") { 
      transitive = false 
     } 
     //checkstyle for groovy 
     test(':codenarc:0.18') 
    } 

当我在运行时将此插件包含在我的项目中并运行'grails compile'时,它无法找到Spring Social类。

.grails/projects/myproject/plugins/web-application-common-paypal-access-1.0.39/src/groovy/com/mycompany/SignInAdapter.groovy: 3: unable to resolve class grails.plugins.springsocial.signin.SpringSocialSimpleSignInAdapter 
@ line 3, column 1. 
    import grails.plugins.springsocial.signin.SpringSocialSimpleSignInAdapter 

我无法弄清楚为什么。任何帮助是极大的赞赏。

感谢, 阿济斯

+0

我其实有类似的问题,我(作为@DerekSilfe建议)指定我的自定义插件,编译时依赖。对于BuildConfig.groovy中的存储库闭包,我使用flatDir方法。 'flatDir名称:'customplugin',dirs:'/ path/to/custom/plugin'' 虽然它_does_安装插件,但它不会过渡地解析dependencies.groovy(或BuildConfig.groovy中包含的依赖关系我打包插件)。因此,当它试图编译插件的源文件时,它无法导入一些需要的类。 – jonnybot 2013-08-14 15:24:10

+0

此外,如果我查看依赖性报告,而我的自定义插件列在那里,它被列为没有依赖关系。我的猜测是本地插件根本无法获得传递解决方案,可能是因为它们打算脱机工作。 – jonnybot 2013-08-14 15:31:14

回答

0

如果你的Grails应用程序代码的插件中它引用类或类该插件包括由于传递依赖,你应该包括该插件为compile时间依赖性,而不是一个runtime依赖。

根据错误消息,SignInAdapter引用SpringSocialSimpleSignInAdapter。尝试更新BuildConfig.groovy如下:

compile ':my-social-security-plugin:0.1'