将Spring安全Rest插件添加到BuildConfig.groovy时编译Grails 2.4.2应用程序时出错

将Spring安全Rest插件添加到BuildConfig.groovy时编译Grails 2.4.2应用程序时出错,grails,spring-security,grails-2.4,spring-security-rest,Grails,Spring Security,Grails 2.4,Spring Security Rest,我有一个使用Spring Security Core的Grails 2.4.2应用程序,我正在尝试实现一个带有身份验证的Restful API。为此,刚刚在我的BuildConfig.groovy文件中添加了SpringSecurityRESTV1.5.4作为插件,如下所示: grails.servlet.version = "2.5" grails.tomcat.nio=false grails.project.class.dir = "target/classes

我有一个使用Spring Security Core的Grails 2.4.2应用程序,我正在尝试实现一个带有身份验证的Restful API。为此,刚刚在我的BuildConfig.groovy文件中添加了SpringSecurityRESTV1.5.4作为插件,如下所示:



    grails.servlet.version = "2.5"
    grails.tomcat.nio=false
    grails.project.class.dir = "target/classes"
    grails.project.test.class.dir = "target/test-classes"
    grails.project.test.reports.dir = "target/test-reports"
    grails.project.work.dir = "target/work"
    grails.project.target.level = 1.6
    grails.project.source.level = 1.6
    grails.project.war.file = "target/${appName}.war"
    grails.project.dependency.resolver = "maven" // or ivy
    grails.project.dependency.resolution = {
        inherits("global") {
        }
        log "info" 
        checksums true
        legacyResolve false
        repositories {
            inherits true

            mavenCentral()
            grailsPlugins()
            grailsHome()
            mavenLocal()
            grailsCentral()
            mavenRepo "http://repository.codehaus.org"
            mavenRepo "http://repo.spring.io/milestone/"
            mavenRepo "http://repo.grails.org/grails/libs-releases-local"
            mavenRepo "http://repo.grails.org/grails/core"
            mavenRepo "http://repo.spring.io/libs-snapshot"

        }

        dependencies {
            compile('com.lowagie:itext-rtf:2.1.7')
            compile('org.codehaus.groovy.modules.http-builder:http-builder:0.7') {
                excludes "commons-logging", "xml-apis", "groovy", "xercesImpl"
            }
            compile 'net.sf.ehcache:ehcache-core:2.4.8'

            test("org.seleniumhq.selenium:selenium-firefox-driver:2.41.0")
            test "org.gebish:geb-spock:0.9.2"

            compile 'org.grails.plugins:events:1.0.0.M1'
            compile 'org.springframework:spring-core:4.0.5.RELEASE'
            compile 'org.springframework:spring-context:4.0.5.RELEASE'
            compile 'org.springframework:spring-beans:4.0.5.RELEASE'
            compile 'commons-beanutils:commons-beanutils:1.8.3'
            compile ('eu.medsea.mimeutil:mime-util:2.1.3'){
                excludes([group:'org.slf4j', name:'slf4j-log4j12', version: '1.5.6'])
            }
            compile ('org.apache.poi:poi:3.10.1'){
                 excludes "xml-apis", "xercesImpl", "stax-api"
            }
            compile ('org.apache.poi:poi-ooxml:3.10.1'){
                 excludes "xml-apis", "xercesImpl", "stax-api"
            }
            compile ( group:'org.springframework.cloud', name:'spring-cloud-starter-eureka', version:'1.0.0.M2', changing: true){
                excludes "logback-classic", "xercesImpl", "tomcat-embed-core", "tomcat-embed-el", "stax-api", "hibernate-validator", "log4j-over-slf4j"
            }
            compile ('com.netflix.ribbon:ribbon-eureka:2.0-RC9'){
                excludes "xercesImpl",  "stax-api"
            }
            compile ('com.netflix.ribbon:ribbon-loadbalancer:2.0-RC9'){
                excludes "xercesImpl",  "stax-api"
            }
            provided ('xerces:xercesImpl:2.9.1'){
                excludes "xml-apis", "stax-api"
            }
            compile 'br.com.caelum.stella:caelum-stella-core:2.1.2'
            compile ('br.com.caelum.stella:caelum-stella-boleto:2.1.2'){
                excludes('itext')
            }
        }

        environments {
            test {
                dependencies {
                    runtime 'org.springframework:spring-test:3.2.9.RELEASE'
                    compile "commons-codec:commons-codec:1.9"
                }
            }
            production{
                dependencies {
                    runtime 'org.springframework:spring-test:3.2.9.RELEASE'
                    compile "commons-codec:commons-codec:1.9"
                }
            }
            development {
                dependencies {
                    runtime 'org.springframework:spring-test:3.2.9.RELEASE'
                    compile "commons-codec:commons-codec:1.9"
                }
            }
        }

        plugins {
            test ":geb:0.9.2"
            build ":tomcat:7.0.54"
            compile ":scaffolding:2.1.2"
            compile ':cache:1.1.7'
            compile ":rest:0.8"
            compile ':spring-security-core:2.0-RC3'
            compile ":spring-security-rest:1.5.4"
            compile ":mail:1.0.6"
            compile ':mongodb:3.0.3'
            compile ":ckeditor:4.4.1.0"

            runtime ":jquery:1.11.0.2"

            compile ':console:1.4.2'
            compile ":asset-pipeline:1.9.9"
            compile ":sass-asset-pipeline:1.9.1"
            compile ":mongodb-create-drop:1.0"
            compile (":export:1.6"){
                excludes "xml-apis", 'itext', 'itext-rtf', "xercesImpl", "stax-api"
            }
            compile (":rendering:1.0.0")
            compile ":br-validation:0.3"
            compile ":google-analytics:2.3.3"
            compile ":cache-headers:1.1.7"
            compile ":jslint:0.6"
        }
    }

执行run app命令时,会显示以下错误:

编译279个源文件
注意:某些输入文件使用或覆盖不推荐使用的API。
注意:有关详细信息,请使用-Xlint:deprecation重新编译。
注意:/tmp/groovy-generated-68181663753307402-java-source/grails/plugin/springsecurity/rest/token/AccessToken.java使用未经检查或不安全的操作。
注意:使用-Xlint重新编译:未选中以获取详细信息。
[groovyc]org.codehaus.groovy.control.multipleComplationErrorsException:启动失败:
[groovyc]/home/aescobar/IdeaProjects/lasa portal fornecedores/portal web/target/work/plugins/spring-security-rest-1.5.4/src/groovy/grails/plugin/springsecurity/rest/token/storage/TokenStorageService.groovy:-1:“instanceEventsApi”字段不是“public static final”,而是在接口中定义的'grails.plugin.springsecurity.rest.token.storage.TokenStorageService'。
[groovyc]@第1行,第1列。
[groovyc]/home/aescobar/IdeaProjects/lasa portal fornecedores/portal web/target/work/plugins/spring-security-rest-1.5.4/src/groovy/grails/plugin/springsecurity/rest/oauth/OauthUserDetailsService.groovy:-1:“instanceEventsApi”字段不是“public static final”,而是在接口中定义的'grails.plugin.springsecurity.rest.oauth.OauthUserDetailsService'。
[groovyc]@第1行,第1列。
[groovyc]2个错误
|编译279个源文件。
|错误编译错误:启动失败:
/home/aescobar/IdeaProjects/lasa portal fornecedores/portal web/target/work/plugins/spring-security-rest-1.5.4/src/groovy/grails/plugin/springsecurity/rest/token/storage/TokenStorageService.groovy:-1:“instanceEventsApi”字段不是“public static final”,而是在接口中定义的'grails.plugin.springsecurity.rest.token.storage.TokenStorageService'。
@第1行,第1列。
/home/aescobar/IdeaProjects/lasa portal fornecedores/portal web/target/work/plugins/spring-security-rest-1.5.4/src/groovy/grails/plugin/springsecurity/rest/oauth/OauthUserDetailsService.groovy:-1:“instanceEventsApi”字段不是“public static final”,而是在接口中定义的'grails.plugin.springsecurity.rest.oauth.OauthUserDetailsService'。
@第1行,第1列。
2个错误


能否尝试从
spring security rest
插件中排除
spring security core
?可以这样做:

 compile ":spring-security-rest:1.5.4", {
     excludes: 'spring-security-core'
 }

或者可以尝试这些插件的不同版本:对我来说,
springsecuritycore:2.0-RC4
springsecurityrest:1.5.0.M2
(有提及的排除)的组合效果很好。

首先,感谢所有试图帮助我的人

我发现问题在于依赖关系
springsecurityrest:1.5.4
org.grails.plugins:events:1.0.0.M1
库冲突

我真的不需要使用这个特定的事件库,所以我只是从我的项目中删除了它。现在,一切都正常运转


谢谢。

你好。谢谢你的评论。我可以看到错误,但由于我没有编写任何代码行,我不知道我可能遗漏了什么。这是配置错误吗?依赖错误?我忘记写代码了吗?我在文档中找不到这方面的提示。谢谢你的回复。我找到了引起冲突的原因。包括
org.grails.plugins:events:1.0.0.M1
库。
 compile ":spring-security-rest:1.5.4", {
     excludes: 'spring-security-core'
 }