我是Gradle和Artifactory的新手,我想将JAR文件上传到Artifactory。
这是我的build.gradle
文件:
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'artifactory-publish'
groupId = 'myGroup'
version = '1.0'
def artifactId = projectDir.name
def versionNumber = version
artifactory {
contextUrl = 'http://path.to.artifactory' // base artifactory url
publish {
repository {
repoKey = 'libs-releases' // Artifactory repository key to publish to
username = 'publisher' // publisher user name
password = '********' // publisher password
maven = true
}
}
}
artifactoryPublish {
dependsOn jar
}
运行artifactoryPublish
任务后,构建成功,如下所示:
> gradle artifactoryPublish --stacktrace
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar
:artifactoryPublish
Deploying build info to: http://path.to.artifactory/api/build
BUILD SUCCESSFUL
Total time: 7.387 secs
但是,除了构建信息外,没有其他任何东西发送给Artifactory。
任何帮助都感激不尽。
编辑:
正如JBaruch所述,我添加了
apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
并将部分默认为人工任务
defaults {
publications ('mavenJava')
}
现在可以了。
谢谢
defaults
实际上进入内部artifactory.publish
,而不仅仅是根artifactory
任务。