2013-05-03 120 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'