发布Spring Boot可执行jar工件 [英] Publishing a spring boot executable jar artifact

查看:72
本文介绍了发布Spring Boot可执行jar工件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用仍在使用 publishing DSL进行孵化的Gradle发布机制.

I'm using the Gradle publishing mechanism that is is still in incubation using the publishing DSL.

    publishing {
        publications {
            mavenJava(MavenPublication) {
                from components.java
                pom.withXml {
                    def parentNode = asNode().appendNode('parent')
                    parentNode.appendNode('groupId', 'org.springframework.boot')
                    parentNode.appendNode('artifactId', 'spring-boot-starter-parent')
                    parentNode.appendNode('version', springBootVersion)
                }
                // BEGIN sourcejar
                artifact sourceJar {
                    classifier "sources"
                }
                // END sourcejar
                artifact sharedTestJar {
                    classifier "sharedtest"
                }
            }
        }

这基本上是可行的,但是一旦我添加了一个分类器,就不再部署重新打包的工件.那么注册重新发布的工件以发布时我必须参考什么配置?

This basically works but as soon as as I'm adding a classifier the repackaged artifact is not deployed anymore. So what configuration do I have to refer to for registering the repackaged artifact for publication?

bootRepackage {
    classifier = 'exec'
}

推荐答案

您必须添加由 bootRepackage 任务创建的jar文件,作为要发布的其他工件.不幸的是, bootRepackage 任务似乎并未将其公开为属性.

You'll have to add the jar file created by the bootRepackage task as an additional artifact to publish. Unfortunately the bootRepackage task doesn't seem to expose this as a property.

artifact(file("$buildDir/$project.name-$project.version-${bootRepackage.classifier}.jar")) {
    classifier 'exec'
}

这篇关于发布Spring Boot可执行jar工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆