How to publish Web application war using gradle in artifactory


(Pradhip P) #1

I’m using gradle in my web application. My build produces a war file. I would like to publish this to an Artifactory repository. No success so far.

Below is the build.gradle

String publishingRepo = war.version.endsWith(‘SNAPSHOT’) ? ‘libs-snapshot-local’ : 'libs-release-local’
publishing {
publications {
webApp(MavenPublication) {
from components.web
}
}

repositories {
maven {
credentials {
username "XXXXX"
password “XXXXX”
}
url “${artifactory_contextUrl}/${publishingRepo}”
}
}
}

artifactory {
contextUrl = “${artifactory_contextUrl}” //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = 'libs-release-local’
username = "XXXXX"
password = “XXXXX”
}
defaults {
publications(‘webApp’)

            }
  
        }   

Please help me with this