Can someone help me to write the gradle script to upload the artifact to artifactory? I want to provide the artifact name through jenkins job as a parameter and the gradle script will upload the artifact with proper groupid, artifactid and version to artifactory with POM file. But I am not sure how to provide the zip as a parameter and I want the zip file upload with some version and build number from the jenkins job
apply plugin: 'java'
apply plugin: 'maven'
repositories {
maven {
url "http://localhost:8081/nexus/content/groups/public"
}
}
dependencies {
testCompile "junit:junit:3.8.1"
compile "org.jbundle.util:org.jbundle.util.jbackup:2.0.0"
compile "net.sf.webtestfixtures:webtestfixtures:2.0.1.3"
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "http://localhost:8081/nexus/content/repositories/snapshots") {
authentication(userName: "admin", password: "admin123")
}
pom.version = "1.0-SNAPSHOT"
pom.artifactId = "simple-project"
pom.groupId = "com.example"
}
}
}
Below is the script which you suggested me
buildscript {
repositories {
maven {
url "http://cm.t.th.com:8/artifactory/files-release-local"
}
}
}
allprojects {
apply plugin: 'java'
group = 'com.trlth.anaengine'
// artifactId = 'reference-files'
version = '0.0.6'
status = 'integration'
}
// Setting this property to true will make the artifactoryPublish task
// skip this module (in our case, the root module):
artifactoryPublish.skip = true
def dir = 'build'
def f = file("$dir/test.txt")
artifacts {
archives file: f, name: f.getName(), type: 'txt'
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}