So, the below war file publishes the jar file and the war file. It publishes the war file because I have it specified under publications as "artifact(file('build/libs/new_file-1.0.war'))".
Question 1: Is there a way to publish war files without specifying full names ?
Question 2: Why is the jar file being published ? I am not even building it ?
buildscript {
repositories {
maven {
url 'http://localhost/artifactory/plugins-release'
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '3.1.1')
}
configurations {
warLib {
transitive=false
}
}
}
apply plugin: "com.jfrog.artifactory"
apply plugin: 'eclipse'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'war'
war {
classpath configurations.warLib
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact(file('build/libs/new_file-1.0.war'))
}
}
}
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = ‘aaa'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
defaults {
publications('mavenJava')
publishPom = false
}
}
resolve {
repository {
repoKey = ‘aba'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
Question 3: Is there a way to pull specific libraries as part of dependencies into specific location ?
dependencies {
compile group: 'a', name: 'application_jar', version: '1.0'
compile group: 'b', name: 'newlock', version:'1.0.0'
testCompile group: 'unit', name: 'unit', version:'1.0'
}
From the above dependencies, I want to pull library a into different directory, lets say build/deps and all the other ones into the .gradle directory in $HOME.
Can somebody please help.
#2. The publications{}
section defines what is published. The line from components.java
adds the jar file. If you do not want to publish the jar, remove that line.
#1 To publish the war file generated by the war plugin, use from components.web
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With