0

刚开始使用 artifactory 来管理我使用的所有库..因此我必须拥有 artifactory 插件。我使用了http://www.jfrog.com/confluence/display/RTF/Gradle+Artifactory+Plugin上的截屏教程,并添加了 buildScript 如下下载插件。

buildscript { 

repositories { 

    maven { url 'http://localhost:8081/artifactory/plugins-release' 

        credentials { 
            username = "${artifactory_user}" 
            password = "${artifactory_password}" 
        } 
    } 
} 

    dependencies { 

        classpath (
            group: 'org.jfrog.buildinfo', name: 
                                 'build-info-extractor-gradle', version: '2.1.0'
        ) 
    } 

}

然后在我的 gradleUserHomeDir 的 gradle.properties 文件中,我有以下内容,密码是由 artifactory 加密的。

artifactory_user=admin
artifactory_password={DESede}ifW8DYgu849GR8EnzUMOlj/L8cwy6FQfRZgHHTyj9L0=
artifactory_contextUrl=http://localhost:8081/artifactory

然后我运行了 gradle 任务。插件已下载,是的,但出了点问题。这是输出

TaskContainer.add() 方法已被弃用,并计划在 Gradle 2.0 中删除。请改用 create() 方法。

FAILURE:构建失败并出现异常。

  • 其中:构建文件 'S:\src\JEE-Workspace\movieplex7\build.gradle' 行:47

  • 出了什么问题:评估根项目“movieplex7”时出现问题。

    非法重复 {DESede}ifW8DYgu849GR8EnzUMOlj/L8cwy6FQfRZgHHTyj9L0=

这是 build.gradle

buildscript { 

repositories { 

    maven { url 'http://localhost:8081/artifactory/plugins-release' 

        credentials { 
            username = "${artifactory_user}" 
            password = "${artifactory_password}" 
        } 
    } 
} 

    dependencies { 

        classpath (
            group: 'org.jfrog.buildinfo', 
                            name: 'build-info-extractor-gradle', version: '2.1.0'
        ) 
    } 
} 

apply plugin: 'war'
apply plugin: 'maven'
apply plugin: 'eclipse-wtp'
apply plugin: 'artifactory'


project.description = 'Java EE 7 Hands-on Lab'
version= '1.0'
group = 'org.glassfish.movieplex7'

artifactory { 

contextUrl = "${artifactory_contextUrl}"
publish {
    repository {
        repoKey = 'libs-release-local' 
        username = "${artifactory_user}" 
        password = "${artifactory_password}" 
        maven = true 
    } 
}

resolve { 

    repository { 
        repoKey = 'libs-release' username = "${artifactory_user}" 
                    password = "${artifactory_password}" maven = true 
    } 
} 


}

dependencies {

providedCompile 'javax:javaee-api:7.0'
//providedCompile 'org.glassfish.main.extras:glassfish-embedded-web:4.0'

}

4

1 回答 1

0

当我像这样将每个属性放在自己的行中时,它突然起作用了

`repoKey = 'libs-release'

用户名 = "${artifactory_user}"

密码 = "${artifactory_password}"

行家=真`

于 2013-07-21T15:26:30.500 回答