Skip to content
Advertisement

Change “bootJar” target directory

New to gradle, facing issues in jenkins pipeline. Entire build is successful but not able to find the bootable jar of my spring project. If you can please let me know how can I move the jar from target/lib/ to /target folder.

Below is my build.gradle

JavaScript

P.S- I tried project.buildDir but that changed the build to target, the jar is still generated inside the target/lib directory.

Advertisement

Answer

In the Configuring executable archive packaging section of the Spring Boot Gradle Plugin Reference Guide we can read:

The BootJar and BootWar tasks are subclasses of Gradle’s Jar and War tasks respectively. As a result, all of the standard configuration options that are available when packaging a jar or war are also available when packaging an executable jar or war.

Having that in mind if we look at Gradle’s Jar plugin documentation it has destinationDirectory property denoting the directory where the archive will be placed.

Try updating your build.gradle script according to this:

JavaScript

This should do the trick.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement