簡體   English   中英

如何使用Gradle版本1.12將本地(.war .jar)文件發布(部署)到Artifactory?

[英]How to Publish (deploy) local (.war .jar) files to Artifactory using Gradle version 1.12?

如何使用Gradle版本1.12將本地(.war .jar)文件發布(部署)到Artifactory?

親愛的大家

我很難做到這一點,因為由於規格而無法更改的較舊版本的Gradle,如果有人可以幫助我使用此代碼,我將非常感激。

到目前為止,我所做的是:

   buildscript {
        repositories {
            maven { url 'http://jcenter.bintray.com' }
        }
        dependencies {
            classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '3.0.1')
        }
    }
    apply plugin: com.jfrog.artifactory-upload'
    artifactory {
        contextUrl = 'http://my.domain.com/artifactory/'  
        resolve {
            repository {
                repoKey = 'remote-deploy'
                maven = true
            }
        }
    }

NOTE: I don't know how to set my the local files to be uploaded but I read that I can use something like this "$rootDir\build\lib\buildProject.war"
 With the suggestions I made this changes in my code: 

應用插件:'com.jfrog.artifactory-upload'應用插件:'maven-publish'應用插件:'maven'應用插件:'distribution'

buildscript {
    repositories {
        maven { url 'http://jcenter.bintray.com' }
    }
    dependencies {
        classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.2.5')
    }
    configurations {
        published
    }
}

artifactoryPublish.skip = true
task sourceJar(type: Jar){
    from file("build/libs/"+project.archivesBaseName2+".jar")
    classifier = 'sources'
}
artifacts{
    archives sourceJar
    published sourceJar
}
artifactory {
    contextUrl = 'http://www site com/artifactory/'
    publish {
        contextUrl = 'http://www site com/artifactory/'   //The base Artifactory URL for the publisher
        //A closure defining publishing information
        repository {
            repoKey = 'jarDeploy'
            username = 'user'
            password = 'pass'
        }
        defaults{
        //This closure defines defaults for all 'artifactoryPublish' tasks of all projects the plugin is applied to

            properties{
                //Optional closure to attach properties to artifacts based on a list of artifact patterns per project publication
                mavenJava 'org.jfrog:*:*:*@*', key1: 'val1'

                publicationName 'group:module:version:classifier@type', key1:'value1', key2:'value2'
            }
            publishBuildInfo = true   //Publish build-info to Artifactory (true by default)
            publishArtifacts = true   //Publish artifacts to Artifactory (true by default)
            publishPom = true   //Publish generated POM files to Artifactory (true by default).
            publishIvy = false   //Publish generated Ivy descriptor files to Artifactory (true by default).
        }
    }
    resolve{
        contextUrl = 'http://www site com/artifactory/'   //The base Artifactory URL for the resolver
        repository{
            repoKey = 'jarDeploy'  //The Artifactory (preferably virtual) repository key to resolve from
            username = 'user'       //Optional resolver user name (leave out to use anonymous resolution)
            password = 'pass'   //The resolver password
            maven = true                //Resolve Maven-style artifacts and descriptors (true by default)
        }
    }
}

現在,我在Arctifactory上看到Build出版物,但沒有任何文件可下載 在此處輸入圖片說明

[buildinfo] Properties file path was not found! (Relevant only for builds running on a CI Server)
Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed
 in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtensi
on.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "publishPom" on "task ':api:artifactoryPublish'", value: "true".
Deprecated dynamic property: "publishIvy" on "task ':api:artifactoryPublish'", value: "false".
Deprecated dynamic property "publishPom" created in multiple locations.
Deprecated dynamic property "publishIvy" created in multiple locations.
:webapp:artifactoryPublish                
Deploying build info to: http://www site com/artifactory/api/build
Build successfully deployed. Browse it in Artifactory under http://tc-scm.bitnamiapp.com/artifactory/webapp/
builds/leadgnome-services/1423748387989/2015-02-12T09:39:45.642-0400/

BUILD SUCCESSFUL

Artifactory插件上傳由另一個插件准備的文件集。 考慮到您的Gradle版本,可能是maven插件。

maven插件創建並填充一個configuration (通常稱為archives ),其中包含它所構建的文件。 需要在artifactory閉包中指定此配置。

您可以在此處看到許多示例。

PS插件的3.0.1版本可能不適用於這樣的舊Gradle。 請檢查文檔中的兼容性列表。

暫無
暫無

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

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