首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用grails项目配置Artifactory

用grails项目配置Artifactory
EN

Stack Overflow用户
提问于 2014-10-15 07:59:25
回答 1查看 1.5K关注 0票数 0

我试图用远程Grails配置一个Artifactory项目,但未能正确配置它。

Envionmanet设置

  1. grails-2.4.3
  2. artifactory.version 3.3.0

BuildConfig.groovy

代码语言:javascript
复制
grails.project.dependency.resolver = "maven" // or ivy

grails.project.ivy.authentication = {
    repositories {
        mavenRepo "http://SERVER/artifactory/grails-remote"
    }
    credentials {
        realm = "Artifactory Realm"
        host = "SERVER"
        username = "USERNAME"
        password = "PASSWORD"
    }
}

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
    legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility

    repositories {
        inherits true // Whether to inherit repository definitions from plugins
        mavenRepo id: 'Artifactory', url: "http://SERVER/artifactory/grails-remote"
    }

    dependencies {
        // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
        // runtime 'mysql:mysql-connector-java:5.1.29'
        // runtime 'org.postgresql:postgresql:9.3-1101-jdbc41'
        test "org.grails:grails-datastore-test-support:1.0-grails-2.4"
    }

    plugins {
        // plugins for the build system only
        build ":tomcat:7.0.55"

        // plugins for the compile step
        compile ":scaffolding:2.1.2"
        compile ':cache:1.1.7'
        compile ":asset-pipeline:1.9.6"

        compile ":rabbitmq:1.0.0"

        // plugins needed at runtime but not for compilation
        runtime ":hibernate4:4.3.5.5" // or ":hibernate:3.6.10.17"
        runtime ":database-migration:1.4.0"
        runtime ":jquery:1.11.1"
    }
}

在执行项目的刷新依赖项命令后获取下面的异常

代码语言:javascript
复制
Loading Grails 2.4.3
|Configuring classpath
Error |
Resolve error obtaining dependencies: The following artifacts could not be resolved: org.grails.plugins:scaffolding:zip:2.1.2, org.grails.plugins:cache:zip:1.1.7, org.grails.plugins:webxml:zip:1.4.1, org.grails.plugins:asset-pipeline:zip:1.9.6, org.grails.plugins:rabbitmq:zip:1.0.0, org.grails.plugins:hibernate4:zip:4.3.5.5, org.grails.plugins:database-migration:zip:1.4.0, org.grails.plugins:jquery:zip:1.11.1: Could not find artifact org.grails.plugins:scaffolding:zip:2.1.2 in Artifactory (http://SERVER/artifactory/grails-remote) (Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: The following artifacts could not be resolved: org.grails.plugins:scaffolding:zip:2.1.2, org.grails.plugins:cache:zip:1.1.7, org.grails.plugins:webxml:zip:1.4.1, org.grails.plugins:asset-pipeline:zip:1.9.6, org.grails.plugins:rabbitmq:zip:1.0.0, org.grails.plugins:hibernate4:zip:4.3.5.5, org.grails.plugins:database-migration:zip:1.4.0, org.grails.plugins:jquery:zip:1.11.1: Could not find artifact org.grails.plugins:scaffolding:zip:2.1.2 in Artifactory (http://SERVER/artifactory/grails-remote) (Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: The following artifacts could not be resolved: org.grails.plugins:scaffolding:zip:2.1.2, org.grails.plugins:cache:zip:1.1.7, org.grails.plugins:webxml:zip:1.4.1, org.grails.plugins:asset-pipeline:zip:1.9.6, org.grails.plugins:rabbitmq:zip:1.0.0: Could not find artifact org.grails.plugins:scaffolding:zip:2.1.2 in Artifactory (http://SERVER/artifactory/grails-remote) (Use --stacktrace to see the full trace)
Error |
The following artifacts could not be resolved: org.grails.plugins:scaffolding:zip:2.1.2, org.grails.plugins:cache:zip:1.1.7, org.grails.plugins:webxml:zip:1.4.1, org.grails.plugins:asset-pipeline:zip:1.9.6, org.grails.plugins:rabbitmq:zip:1.0.0: Could not find artifact org.grails.plugins:scaffolding:zip:2.1.2 in Artifactory (http://SERVER/artifactory/grails-remote)
|Run 'grails dependency-report' for further information.
Process was killed

我已经阅读并尝试了几种解决方案,如下面的链接所述,但它没有帮助

  1. How to configure grails 2.4.0 to resolve artifacts from artifactory with authentication?
  2. http://wordpress.transentia.com.au/wordpress/2014/04/09/artifactory-and-grails/

Update1:

在仔细查看Artifactory's apache catalina log之后,我发现对于某些插件来说,它导致了一些禁止的错误。

代码语言:javascript
复制
2014-10-15 15:16:19,596 [ajp-bio-8019-exec-10] [INFO ] (o.a.r.s.RepositoryBrowsingServiceImpl:236) - Error while listing remote resources for codehaus/org/grails/grails-datastore-gorm-mongo: Unable to retrieve http://repository.codehaus.org/org/grails/grails-datastore-gorm-mongo/: 403: Forbidden

有人能帮我找出配置有什么问题吗?

你好,梅兰克

EN

回答 1

Stack Overflow用户

发布于 2014-10-15 08:22:08

与其用grails.project.ivy.authentication定义存储库身份验证,不如使用以下方法定义存储库:

代码语言:javascript
复制
grails.project.dependency.resolution = {
    repositories {
        grailsCentral()
        ....
        mavenRepo(name: 'name', url: 'https://host/artifactory/reponame') {
            auth(username: 'username', password: 'password')
        }
        ....
    }
}
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26377380

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档