簡體   English   中英

使用Gradle將War文件發布到工件

[英]Publishing war file to artifactory using gradle

因此,下面的war文件將發布jar文件和war文件。 它發布了war文件,因為我在出版物中將其指定為“ artifact(file('build / libs / new_file-1.0.war'))”。

問題1:是否可以在不指定全名的情況下發布war文件?

問題2:為什么要發布jar文件? 我什至不建嗎?

buildscript {
    repositories {
        maven {
            url 'http://localhost/artifactory/plugins-release'
            credentials {
                username = "${artifactory_user}"
                password = "${artifactory_password}"
            }
        }
        dependencies {
            classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '3.1.1')
        }
        configurations {
            warLib {
                transitive=false
            }
        }
    }

    apply plugin: "com.jfrog.artifactory"
    apply plugin: 'eclipse'
    apply plugin: 'java'
    apply plugin: 'maven'
    apply plugin: 'maven-publish'
    apply plugin: 'war'

    war {
        classpath configurations.warLib
    }

    publishing {
        publications {
            mavenJava(MavenPublication) {
                from components.java
                artifact(file('build/libs/new_file-1.0.war'))
                }
        }
    }

    artifactory {
        contextUrl = "${artifactory_contextUrl}"   //The base Artifactory URL if not overridden by the publisher/resolver
        publish {
            repository {
                repoKey = ‘aaa'
                username = "${artifactory_user}"
                password = "${artifactory_password}"
                maven = true
            }

            defaults {
                publications('mavenJava')
                publishPom = false
            }
        }
        resolve {
            repository {
                repoKey = ‘aba'
                username = "${artifactory_user}"
                password = "${artifactory_password}"
                maven = true
            }
        }
    }

問題3:有沒有辦法將特定庫作為依賴項的一部分拉到特定位置?

dependencies {
    compile group: 'a', name: 'application_jar', version: '1.0'
    compile group: 'b', name: 'newlock', version:'1.0.0'
    testCompile group: 'unit', name: 'unit', version:'1.0'
}

從以上依賴關系中,我想將庫a拉到不同的目錄中,比如說build / deps以及其他所有目錄都放在$ HOME的.gradle目錄中。

有人可以幫忙嗎?

#2。 publications{}部分定義了發布的內容。 from components.java的行添加了jar文件。 如果您不想發布jar,請刪除該行。

#1要發布war插件生成的war文件,請使用from components.web

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM