gpt4 book ai didi

java - 无法解析 grails 3 的 grails-oauth-scribe 中的类 org.scribe.builder.api.FacebookApi

转载 作者:太空宇宙 更新时间:2023-11-04 11:40:41 25 4
gpt4 key购买 nike

这可能是一个菜鸟错误,但我似乎找不到它,已经尝试了两天。我正在尝试使用 grails-oauth-scribe 插件在我的 grails 3 应用程序中集成一个简单的 facebook 登录,该插件利用 Scribe oauth API。所以安装插件很自然就会安装这些依赖API类。但我认为事实并非如此,因为当我在 application.groovy

中导入 FacebookAPI 时
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"
}

我知道这是一个类解析错误,所以我尝试手动包含抄写员 jar,但没有任何反应。如果有帮助,我会发布 application.yml

oauth:
providers:
facebook:
api: org.scribe.builder.api.FacebookApi
key: 'my key'
secret: 'secret'

在我看来一切都很好,一定是有些愚蠢的事情。

最佳答案

尝试添加此依赖项:

    dependency {
compile 'org.scribe:scribe:+'
}

关于java - 无法解析 grails 3 的 grails-oauth-scribe 中的类 org.scribe.builder.api.FacebookApi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42817200/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com