带有grails的Spring Security Core插件

时间:2016-05-04 16:12:16

标签: grails spring-security

我在开发应用程序中通过GGTS 3.4.0使用grails 2.3.3,现在我想开始使用Spring安全核心插件。

我试图通过在BuildConfig.groovy文件的插件部分添加以下行来在我的应用程序构建中包含它,但未成功:

compile "org.grails.plugins:spring-security-core:2.0.0"

但是在执行run-app时会在该插件上出现此依赖项错误:

  

解决获取依赖关系的错误:无法解析依赖关系

看着我试过的另一张纸条:

compile "org.grails.plugins:spring-security-core:2.0-RC2"

在buildconfig文件的插件部分中:

        mavenRepo 'http://repo.spring.io/milestone'

在具有相同依赖性错误问题的文件的存储库部分。

我使用的grails / GGTS版本的插件版本是否错误?

这是当前的BuildConfig.groovy:

grails.servlet.version = "2.5" // Change depending on target container     compliance (2.5 or 3.0)
grails.project.work.dir = 'target'
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.target.level = 1.6
grails.project.source.level = 1.6
//grails.project.war.file = "target/${appName}-${appVersion}.war"

grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
    // specify dependency exclusions here; for example, uncomment this to    disable ehcache:
    // excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info',  'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve

repositories {
    inherits true // Whether to inherit repository definitions from plugins

    grailsPlugins()
    grailsHome()
    grailsCentral()

    mavenLocal()

    mavenCentral()

    // uncomment these (or add new ones) to enable remote dependency  resolution from public Maven repositories
    //mavenRepo "http://snapshots.repository.codehaus.org"
    //mavenRepo "http://repository.codehaus.org"
    //mavenRepo "http://download.java.net/maven/2/"
    //mavenRepo "http://repository.jboss.com/maven2/"

    mavenRepo 'http://repo.spring.io/milestone'

    grailsRepo "http://grails.org/plugins"

}
dependencies {
    // specify dependencies here under either 'build', 'compile', 'runtime',  'test' or 'provided' scopes eg.

    // runtime 'mysql:mysql-connector-java:5.1.20'
    runtime 'mysql:mysql-connector-java:5.1.27'

    compile "org.grails.plugins:spring-security-core:2.0.0"


}

plugins {
    //runtime ":hibernate:$grailsVersion"

    //compile 'utils:utils:1.4-SNAPSHOT'

    compile ":hibernate:3.6.10.4"

    //runtime ":jquery:1.7.2"
    runtime ":jquery:1.10.2"

    //runtime ':pvpi:0.1-SNAPSHOT'
    //runtime (':pvpi:0.1'){
        //changing = true
    //}

    //runtime ":resources:1.1.6"
    runtime ":resources:1.2.1"

    // Uncomment these (or add new ones) to enable additional resources capabilities
    //runtime ":zipped-resources:1.0"
    //runtime ":cached-resources:1.0"
    //runtime ":yui-minify-resources:0.1.4"

    build ":tomcat:7.0.47"
    //build ":tomcat:$grailsVersion"

    //runtime ":database-migration:1.1"
    runtime ":database-migration:1.3.8"

    //compile ':cache:1.0.0'
    compile ':cache:1.1.1'

    compile ":scaffolding:2.0.0"

    compile ":spring-security-core:2.0.0"

    }
}

发送到控制台的日志显示构建去尝试的所有在线位置,并找到spring-security-core软件 - 以下是所有这些位置的列表:

  

grailsCentral:http://grails.org/plugins/grails-spring-security-core/tags/RELEASE_3.1.1/spring-security-core-3.1.1.pom

     

mavenCentral:http://repo1.maven.org/maven2/org/grails/plugins/spring-security-core/3.1.1/spring-security-core-3.1.1.pom

     

http://mvnrepository.com/artifact/http://mvnrepository.com/artifact/org/grails/plugins/spring-security-core/3.1.1/spring-security-core-3.1.1.pom

     

http://repo.spring.io/milestone/http://repo.spring.io/milestone/org/grails/plugins/spring-security-core/3.1.1/spring-security-core-3.1.1.pom

     

http://grails.org/pluginhttp://grails.org/plugin/grails-spring-security-core/tags/RELEASE_3.1.1/spring-security-core-3.1.1.pom

-Mike

2 个答案:

答案 0 :(得分:1)

如果您尝试使用

怎么办?
user_count_dict = {str(int(year))+'/'+str(int(month)): total for total, month, year in users_count}
# get(x) returns None if a key not in the dict
data = [user_count_dict.get(x) for x in all_months_necessary]

在BuildConfig.groovy插件部分

答案 1 :(得分:0)

您可以访问上面的关注链接以获取此插件的最新版本。

https://repo.grails.org/grails/core/org/grails/plugins/spring-security-core/

现在,正确的命令是:

compile "org.grails.plugins:spring-security-core:3.1.1"

适合我。