【发布时间】:2016-08-23 09:57:34
【问题描述】:
我正在尝试使用 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
【问题讨论】:
-
您要求 Gradle 运行哪些任务,当您尝试发布时它实际运行的是哪些任务?
-
我已经添加了命令+输出
标签: gradle spring-boot artifactory