Настройте Artifactory с помощью проекта Grails

Я пытаюсь настроить проект Grails с удаленным Artifactory, но не могу настроить его должным образом.

Настройка Envionmanet

  1. Грааль-2.4.3
  2. Артефактори.версия 3.3.0

BuildConfig.groovy

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"
    }
}

Получение приведенного ниже исключения после выполнения команды обновления зависимостей для проекта

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. Как настроить Grails 2.4.0 для разрешения артефактов из артефактов с аутентификацией?
  2. http://wordpress.transentia.com.au/wordpress/2014/04/09/artifactory-and-grails/

Обновление 1:

Внимательно изучив Artifactory's apache catalina log, я обнаружил, что для некоторых плагинов это вызывает какую-то запрещенную ошибку.

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

Может ли кто-нибудь помочь мне узнать, что не так с конфигурацией?

Привет, Маянк.


person Mayank    schedule 15.10.2014    source источник
comment
Кто-нибудь может помочь мне в этом? Тем не менее я на той же линии.   -  person Mayank    schedule 27.10.2014


Ответы (1)


Вместо того, чтобы определять аутентификацию репозитория с помощью grails.project.ivy.authentication, вам, вероятно, следует определить репозиторий с помощью:

grails.project.dependency.resolution = {
    repositories {
        grailsCentral()
        ....
        mavenRepo(name: 'name', url: 'https://host/artifactory/reponame') {
            auth(username: 'username', password: 'password')
        }
        ....
    }
}
person noamt    schedule 15.10.2014
comment
Спасибо за ответ. Я пробовал с изменениями, которые вы предложили, но не смог помочь. Я все еще работаю с той же ошибкой. Вы упомянули grailsCentral() в теге репозиториев, я полагаю, что он будет напрямую загружать плагин из центрального репозитория Grails, но я хочу, чтобы вся загрузка библиотеки и плагина проходила через Artifactory. - person Mayank; 15.10.2014
comment
Вы уверены, что ваш артефакт правильно проксирует центральную часть Grails? - person noamt; 15.10.2014
comment
Можете ли вы просто сказать мне, как я могу подтвердить? - person Mayank; 15.10.2014
comment
Вам нужно добавить Grails Central в качестве удаленного репозитория в Artifactory. - person noamt; 15.10.2014