1
這可能是一個新手的錯誤,但我似乎無法找到它,一直在嘗試2天。 我正在嘗試使用Grails-oauth-scribe插件在我的grails 3應用程序中集成一個簡單的Facebook登錄,該插件使用Scribe oauth API。所以安裝插件很自然會安裝這些依賴API類。但我認爲這一點兒也不,因爲當我導入FacebookAPI我application.groovy無法解析grails-oauth-scribe中Grails類的org.scribe.builder.api.FacebookApi 3
import org.scribe.builder.api.FacebookApi
oauth {
providers {
facebook {
api = FacebookApi
key = 'my key'
secret = 'my secret'
successUri = "${application.baseUrl}/hello/oauthFb"
callback = "${application.baseUrl}/oauth/facebook/callback"
}
}
}
我得到這個錯誤
$ grails compile --stacktrace --verbose [21:54:04]
| Error Error occurred running Grails CLI: startup failed:
script1489599921993319590921.groovy: 1: unable to resolve class org.scribe.builder.api.FacebookApi
@ line 1, column 1.
import org.scribe.builder.api.FacebookApi
^
1 error
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
script1489599921993319590921.groovy: 1: unable to resolve class org.scribe.builder.api.FacebookApi
@ line 1, column 1.
import org.scribe.builder.api.FacebookApi
^
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:946)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:542)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:254)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:211)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:221)
at groovy.lang.GroovyClassLoader$parseClass.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at groovy.util.ConfigSlurper.parse(ConfigSlurper.groovy:170)
at org.grails.config.CodeGenConfig.loadGroovy(CodeGenConfig.groovy:148)
at org.grails.cli.GrailsCli.loadApplicationConfig(GrailsCli.groovy:592)
at org.grails.cli.GrailsCli.initializeApplication(GrailsCli.groovy:291)
at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:269)
at org.grails.cli.GrailsCli.main(GrailsCli.groovy:159)
| Error Error occurred running Grails CLI: startup failed:
script1489599921993319590921.groovy: 1: unable to resolve class org.scribe.builder.api.FacebookApi
@ line 1, column 1.
import org.scribe.builder.api.FacebookApi
^
1 error
的build.gradle依賴性來
dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:scaffolding"
compile "org.grails.plugins:hibernate5"
compile "org.hibernate:hibernate-core:5.1.1.Final"
compile "org.hibernate:hibernate-ehcache:5.1.1.Final"
compile 'org.grails.plugins:spring-security-core:3.1.1'
compile 'org.grails.plugins:oauth:3.0.1'
compile fileTree(dir: 'libs', include: '*.jar')
console "org.grails:grails-console"
profile "org.grails.profiles:web"
provided "org.codehaus.groovy:groovy-ant"
runtime 'mysql:mysql-connector-java:5.1.29'
runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.11.1"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"
}
據我所知,這是一個類的解析錯誤,所以我試圖手動包括抄寫筆罐,但沒有 發生。我將張貼application.yml如果它可以幫助
oauth:
providers:
facebook:
api: org.scribe.builder.api.FacebookApi
key: 'my key'
secret: 'secret'
一切似乎好了給我,一定是一些愚蠢的。
沒了,沒有任何幫助。還是一樣 –