如何在不更改名称的情况下将文件部署到artifactory?

时间:2017-09-28 09:29:25

标签: build.gradle

我正在尝试使用gradle将“20170928-WSName.zip”部署到artifactory。结果我的文件名为“20170928-WSName-.zip”。版本自动添加。如何部署文件而不添加文件名?也许还有另一个(非maven?)插件用于此目的?

apply plugin: 'maven'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'                                   

ext {
    WSName = 'WSName'
    ArchiveName = '20170928-WSName'
    Dir = 'directory'
}

buildscript {
    repositories {
        maven {
            url 'http://...'
        }
    }
    dependencies {
        classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.4.7' 
    }
}

artifacts {
    archives file:file(ArchiveName + '.zip'), name:ArchiveName, type:'zip'
}

publishing {
    publications {
        maven(MavenPublication) {
    }
}

artifactory {
    archivesBaseName = WSName
    version = ''
    group = Dir

    publish {
        contextUrl = 'http://...'
        repository {
            repoKey = 'repokey'
            username = 'user_name'
            password = 'pass'
        }
        defaults {
            //publications('maven')
            publishConfigs('archives') 
            publishBuildInfo = false
            publishArtifacts = false
            publishPom = false
            publishIvy = false
        }
    }
} 

1 个答案:

答案 0 :(得分:0)

在maven中,可以使用<finalName>标记下的标记<build>来实现:

<build>
    <finalName>20170928-WSName</finalName>
    ....
</build>

archiveName看起来像gradle中的类似属性used as: -

jar.archiveName = "20170928-WSName.zip"