我正在尝试使用gradle artifactory插件maven-publish插件将jar pom文件部署到artifactory .
我尝试了其他来源的多个解决方案,比如this,我认为spring-boot插件正在破坏东西(因为它编辑了jar文件)
以下脚本成功上载.pom文件,但不上载spring-boot生成的.jar文件 . 我如何才能上传它?
这是我的build.gradle:
buildscript {
ext {
springBootVersion = '1.4.0.RELEASE'
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.4.0"
}
}
apply plugin: 'java'
apply plugin: 'spring-boot'
apply plugin: "com.jfrog.artifactory"
apply plugin: 'maven-publish'
apply from: "gradle/artifactory.gradle"
publishing {
publications {
mavenJava(MavenPublication) {
components.java
}
}
}
jar {
baseName = 'BatchParser'
}
version = '1.0'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.projectlombok:lombok:1.16.10')
...
testCompile('org.springframework.boot:spring-boot-starter-test')
}
和artifactory.gradle
artifactory {
contextUrl = 'url'
publish {
repository {
repoKey = 'libs-release-local'
username = 'user'
password = 'password'
}
defaults {
publications("mavenJava")
}
}
}
输出:
gradlew clean build artifactoryPublish
[buildinfo] Not using buildInfo properties file for this build.
:clean
:compileJava
:processResources
:classes
:findMainClass
:jar
:bootRepackage
:assemble
:compileTestJava
:processTestResources UP-TO-DATE
:testClasses
:test
:check
:build
:generatePomFileForMavenJavaPublication
:artifactoryPublish
Deploying artifact: http://url/libs-release-local/BatchParser/1.0/BatchParser-1.0.pom
Deploying build descriptor to: http://url/api/build
Build successfully deployed. Browse it in Artifactory under http://url/webapp/builds/BatchParser/1471949957594
1 回答
你的
publishing
块中有一个非常微妙的错误 . 缺少from
导致Gradle无法在发布中包含jar文件 . 您需要更新publishing
块,使其看起来像这样:如果我是你,我会为此打开一个Gradle可用性错误 . 默默无所事事并不是非常用户友好 .