Reputation: 261
How to Publish (deploy) local (.war .jar) files to Artifactory using Gradle version 1.12?
Dear all
I'm having a hard time trying to make this because of the older version of Gradle that I can not change because specifications, I would be very gratefully if someone can help me with this code.
What I have done till now:
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:
apply plugin: 'com.jfrog.artifactory-upload' apply plugin: 'maven-publish' apply plugin: 'maven' apply plugin: '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)
}
}
}
Now I see Build publications on Arctifactory but are empty no files to download
[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
Upvotes: 2
Views: 3851
Reputation: 22893
Artifactory plugin uploads a file set that is prepared by another plugin. Considering your version of Gradle, that will probably be the maven
plugin.
maven
plugin creates and populates a configuration
(usually called archives
) which contains the files it built. This configuration needs to be specified in the artifactory
closure.
You can see number of examples here.
P.S. The 3.0.1 version of the plugin won't probably work with such and old Gradle. Please check the docs for the compatibility matrix.
Upvotes: 0