p.s*_*eef 3 artifactory gradle spring-boot
我正在尝试使用gradle + artifactory插件+ maven-publish插件将jar + pom文件部署到工件中。
我试着像来自其他来源的多种解决方案这个,我觉得春天启动插件是打破东西(因为它编辑的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')
}
Run Code Online (Sandbox Code Playgroud)
和artifactory.gradle
artifactory {
contextUrl = 'url'
publish {
repository {
repoKey = 'libs-release-local'
username = 'user'
password = 'password'
}
defaults {
publications("mavenJava")
}
}
}
Run Code Online (Sandbox Code Playgroud)
输出:
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
Run Code Online (Sandbox Code Playgroud)
您的publishing区块中有一个非常细微的错误。from丢失,导致Gradle默默地不在发布中包含jar文件。您需要更新您的publishing块,使其看起来像这样:
publications {
mavenJava(MavenPublication) {
from components.java
}
}
Run Code Online (Sandbox Code Playgroud)
如果我是你,我会为此打开一个Gradle可用性错误。静默无所事事不是很友好。
| 归档时间: |
|
| 查看次数: |
1707 次 |
| 最近记录: |