通过gradle将zip(自定义gradle包装器)上传到artifactory

时间:2016-10-21 09:34:35

标签: gradle artifactory

我想将自定义gradle包装器上传到artifactory。 我试过了:

  1. 来自gradle'base'插件的标准上传任务
  2. artifactory gradle plugin
  3. 我总是有一些像/group/name/revision/[name]-[revision].zip这样的布局 我需要的是简单的repo/name-revision.zip,就像在gradle-distribution存储库中一样:https://services.gradle.org/distributions

    我正在尝试使用'Gradle'布局将zip上传到gradle-local pregenerated artifactory repo

    我读过有关常春藤布局等的内容,但对于这么简单的任务来说,这一切看起来都很复杂。

    有什么建议吗?

1 个答案:

答案 0 :(得分:0)

使用gradle-3.1这对我有用:

gradle.properties

artifactory = http://yourserver/artifactory/reponame
artifactoryUser = username
artifactoryPassword = the-encryped-password

build.gradle

apply plugin: 'maven'
apply plugin: 'distribution'

group = 'foo.bar'
version = '0.5-SNAPSHOT'

// not needed since we have standard layout src/main/dist
// distributions { main { contents { from { ... } } } }

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: artifactory) {
                authentication(userName: artifactoryUser, password: artifactoryPassword)
            }
            snapshotRepository(url: artifactory) {
                authentication(userName: artifactoryUser, password: artifactoryPassword)
            }
        }
    }
}

$> tree src
src
└── main
    └── dist
        ├── bla.txt
        └── blub.txt

$> ./gradlew uploadArchives
:distTar
:distZip
:uploadArchives

BUILD SUCCESSFUL

Total time: 1.332 secs

然后可以在神器中找到拉链