Hi Team,
I’m trying to upload my Project’s Gradle artifacts to JFROG-Artifactory using the below gradle-cli command.
“build artifactoryPublish”
Please find the build.gradle i have used
apply plugin: 'war'
war.archiveName "Sample.war"
buildscript {
repositories {
maven {
url 'https://abcd-artifactory.com:443/artifactory/maven-plugins-release-virtual'
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
}
dependencies {
//Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.15.1"
}
//configurations {
// warLib {
// transitive=false
// }
//}
}
apply plugin: "com.jfrog.artifactory"
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
//artifacts {
// archives file("Sample.war")
//}
//war {
// classpath configurations.warLib
//}
publishing {
publications {
mavenJava(MavenPublication) {
from components.web
groupId = 'ABCD'
artifactId = 'DEV'
version = "1.0"
//artifact(file('build/libs/Sample.war'))
}
}
}
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = 'team-abcd'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
defaults {
publications('mavenJava')
//publishConfigs('archives')
publishArtifacts = true
properties = ['qa.level': 'basic', 'dev.team' : 'core']
publishBuildInfo = false
publishPom = false
}
resolve {
repository {
repoKey = 'maven-libs-release-virtual'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
}
After running “gradle build artifactoryPublish”, i can see that the war file is being sent to the Artifactory (attached image)
I have a couple of queries
1.Is there a way the name of war file appearing in Artifactory can be modified (by modifying build.gradle) during the gradle tasks? if yes, how?
It’s currently showing “DEV-1.0.war” , i would like to see any custom name ex-- WELCOME.war
-
Why is the pom file being published even though i have set “publishPom=false” in the defaults section
-
I’m using war plugin to set Custom name of War file, how can i upload that Sample.war to Artifactory
Thanks in advance.