Java 如何使用Gradle1.12版将本地(.war.jar)文件发布(部署)到Artifactory?
如何使用Gradle 1.12版将本地(.war.jar)文件发布(部署)到Artifactory? 各位亲爱的 我很难做到这一点,因为Gradle的旧版本我无法更改,因为规范,如果有人能帮我编写这段代码,我将非常感激 我到目前为止所做的:Java 如何使用Gradle1.12版将本地(.war.jar)文件发布(部署)到Artifactory?,java,maven,gradle,artifactory,Java,Maven,Gradle,Artifactory,如何使用Gradle 1.12版将本地(.war.jar)文件发布(部署)到Artifactory? 各位亲爱的 我很难做到这一点,因为Gradle的旧版本我无法更改,因为规范,如果有人能帮我编写这段代码,我将非常感激 我到目前为止所做的: buildscript { repositories { maven { url 'http://jcenter.bintray.com' } } dependencies {
buildscript {
repositories {
maven { url 'http://jcenter.bintray.com' }
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '3.0.1')
}
}
apply plugin: com.jfrog.artifactory-upload'
artifactory {
contextUrl = 'http://my.domain.com/artifactory/'
resolve {
repository {
repoKey = 'remote-deploy'
maven = true
}
}
}
NOTE: I don't know how to set my the local files to be uploaded but I read that I can use something like this "$rootDir\build\lib\buildProject.war"
应用插件:“com.jfrog.artifactory上传”
应用插件:“maven发布”
应用插件:“maven”
应用插件:“分发”
buildscript {
repositories {
maven { url 'http://jcenter.bintray.com' }
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.2.5')
}
configurations {
published
}
}
artifactoryPublish.skip = true
task sourceJar(type: Jar){
from file("build/libs/"+project.archivesBaseName2+".jar")
classifier = 'sources'
}
artifacts{
archives sourceJar
published sourceJar
}
artifactory {
contextUrl = 'http://www site com/artifactory/'
publish {
contextUrl = 'http://www site com/artifactory/' //The base Artifactory URL for the publisher
//A closure defining publishing information
repository {
repoKey = 'jarDeploy'
username = 'user'
password = 'pass'
}
defaults{
//This closure defines defaults for all 'artifactoryPublish' tasks of all projects the plugin is applied to
properties{
//Optional closure to attach properties to artifacts based on a list of artifact patterns per project publication
mavenJava 'org.jfrog:*:*:*@*', key1: 'val1'
publicationName 'group:module:version:classifier@type', key1:'value1', key2:'value2'
}
publishBuildInfo = true //Publish build-info to Artifactory (true by default)
publishArtifacts = true //Publish artifacts to Artifactory (true by default)
publishPom = true //Publish generated POM files to Artifactory (true by default).
publishIvy = false //Publish generated Ivy descriptor files to Artifactory (true by default).
}
}
resolve{
contextUrl = 'http://www site com/artifactory/' //The base Artifactory URL for the resolver
repository{
repoKey = 'jarDeploy' //The Artifactory (preferably virtual) repository key to resolve from
username = 'user' //Optional resolver user name (leave out to use anonymous resolution)
password = 'pass' //The resolver password
maven = true //Resolve Maven-style artifacts and descriptors (true by default)
}
}
}
现在我在Arctifactory上看到构建出版物,但它们是空的,没有可下载的文件
Artifactory插件上载由另一个插件准备的文件集。考虑到你的Gradle版本,这可能就是
maven
插件
maven
插件创建并填充一个配置(通常称为存档
),其中包含它构建的文件。此配置需要在artifactory
闭包中指定
你可以看到很多例子
另外,3.0.1版本的插件可能无法与这样的老Gradle一起使用。请检查兼容性矩阵。非常感谢,但我还没有运气,我尝试按照您的指示使用github中的示例,但我仍然无法在Artifactory中上载任何文件。该插件似乎适用于3.0.1版和2.2.5版,但尽管我无法发布任何内容,但我不确定。您是否将配置添加到了闭包中?如果是这样,请用相关代码更新问题。[code]buildscript{repositories{maven{url'}dependentials{classpath'com.github.dcendents:android maven plugin:1.0'classpath(group:'org.jfrog.buildinfo',name:'build info extractor gradle',version:'2.2.5')}工件{homeDir=file('c:/file.war')存档homeDir}[/code]请更新问题。注释不是粘贴代码块的地方。谢谢,我这么做了,但是现在我看不到任何上传到Artifactory Build的文件,就像上面的图片一样。我按照您的git示例更新代码,现在我可以看到Artifactory中的Build,但其中没有文件。这是gradle artifactorybuil的结果D
buildscript {
repositories {
maven { url 'http://jcenter.bintray.com' }
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.2.5')
}
configurations {
published
}
}
artifactoryPublish.skip = true
task sourceJar(type: Jar){
from file("build/libs/"+project.archivesBaseName2+".jar")
classifier = 'sources'
}
artifacts{
archives sourceJar
published sourceJar
}
artifactory {
contextUrl = 'http://www site com/artifactory/'
publish {
contextUrl = 'http://www site com/artifactory/' //The base Artifactory URL for the publisher
//A closure defining publishing information
repository {
repoKey = 'jarDeploy'
username = 'user'
password = 'pass'
}
defaults{
//This closure defines defaults for all 'artifactoryPublish' tasks of all projects the plugin is applied to
properties{
//Optional closure to attach properties to artifacts based on a list of artifact patterns per project publication
mavenJava 'org.jfrog:*:*:*@*', key1: 'val1'
publicationName 'group:module:version:classifier@type', key1:'value1', key2:'value2'
}
publishBuildInfo = true //Publish build-info to Artifactory (true by default)
publishArtifacts = true //Publish artifacts to Artifactory (true by default)
publishPom = true //Publish generated POM files to Artifactory (true by default).
publishIvy = false //Publish generated Ivy descriptor files to Artifactory (true by default).
}
}
resolve{
contextUrl = 'http://www site com/artifactory/' //The base Artifactory URL for the resolver
repository{
repoKey = 'jarDeploy' //The Artifactory (preferably virtual) repository key to resolve from
username = 'user' //Optional resolver user name (leave out to use anonymous resolution)
password = 'pass' //The resolver password
maven = true //Resolve Maven-style artifacts and descriptors (true by default)
}
}
}
[buildinfo] Properties file path was not found! (Relevant only for builds running on a CI Server)
Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed
in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtensi
on.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "publishPom" on "task ':api:artifactoryPublish'", value: "true".
Deprecated dynamic property: "publishIvy" on "task ':api:artifactoryPublish'", value: "false".
Deprecated dynamic property "publishPom" created in multiple locations.
Deprecated dynamic property "publishIvy" created in multiple locations.
:webapp:artifactoryPublish
Deploying build info to: http://www site com/artifactory/api/build
Build successfully deployed. Browse it in Artifactory under http://tc-scm.bitnamiapp.com/artifactory/webapp/
builds/leadgnome-services/1423748387989/2015-02-12T09:39:45.642-0400/
BUILD SUCCESSFUL