[英]Publishing war file to artifactory using gradle
So, the below war file publishes the jar file and the war file. 因此,下面的war文件将发布jar文件和war文件。 It publishes the war file because I have it specified under publications as "artifact(file('build/libs/new_file-1.0.war'))". 它发布了war文件,因为我在出版物中将其指定为“ artifact(file('build / libs / new_file-1.0.war'))”。
Question 1: Is there a way to publish war files without specifying full names ? 问题1:是否可以在不指定全名的情况下发布war文件?
Question 2: Why is the jar file being published ? 问题2:为什么要发布jar文件? 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 ? 问题3:有没有办法将特定库作为依赖项的一部分拉到特定位置?
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. 从以上依赖关系中,我想将库a拉到不同的目录中,比如说build / deps以及其他所有目录都放在$ HOME的.gradle目录中。
Can somebody please help. 有人可以帮忙吗?
#2. #2。 The publications{}
section defines what is published. publications{}
部分定义了发布的内容。 The line from components.java
adds the jar file. from components.java
的行添加了jar文件。 If you do not want to publish the jar, remove that line. 如果您不想发布jar,请删除该行。
#1 To publish the war file generated by the war plugin, use from components.web
#1要发布war插件生成的war文件,请使用from components.web
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.