Will W
Will W

Reputation: 33

Spring Boot Upload BootRepackage Executable Jar

I am using Spring-Boot to develop my new project. In my build.gradle file, I am using 'bootRepackage.classifier', so I can separately generate the default jar of my project and the executable jar that is generated using Spring Boot. I would like to publish both jars, but I am running into issues. I am using the uploadArchives task to upload my jars to a Nexus Maven repository. I can only get my default jar to upload. Here is the part of my build.gradle file that pertains to uploading the archive:

bootRepackage.classifier = 'exec'

jar {
    baseName='default'
    version = '1.0.0'
}

uploadArchives {
    repositories {
       mavenDeployer {
             repository(url: "repositoryURL") {
                 authentication(userName: "username", password: "password")
             }   
             pom.groupId = 'groupId'    
             pom.version = "1.0.0"  
       }
    }
}

Am I missing something?

Upvotes: 3

Views: 2405

Answers (1)

alexbt
alexbt

Reputation: 17085

There is a couple solutions elsewhere on SO:

Publishing a spring boot executable jar artifact:

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

Gradle maven-publish does not build standalone spring-boot application:

publish {
    dependsOn assemble
} 

Upvotes: 1

Related Questions