How to make bootRepackage depends on jar, not war when using Gradle War Plugin

Without the Gradle War Plugin, the bootRepackage task depends on the jar task, but with the Gradle War Plugin, it depends on the war task.

How can I change it to depend on the jar task, although I use the Gradle War Plugin?

UPDATE:

I use the war task to create a war file, including documents that will be deployed to the documentation server, and I want to use the bootRepackage d jar file to provide the service. My war task depends on the asciidoctor task, which depends on the test task (I use Spring REST Docs.), But I don't want to run the asciidoctor or test task when using bootRepackage .

I solved the problem with the following setup:

 ext { mainClassName = 'com.izeye.throwaway.Application' } task myBootRepackage(type: BootRepackage, dependsOn: jar) { } 

but I'm not sure this is a good practice.

This is an example project having the above configuration:

https://github.com/izeye/spring-boot-throwaway-branches/tree/war

+5
source share
1 answer

You should have done this:

 bootRepackage { withJarTask jar } 

While this correctly leads to the repackaging of the jar task jar, it does not eliminate dependency on the military task. This is another symptom of this Spring boot problem .

Until this problem is resolved, the approach you choose - declaring your own BootRepackage task and manually setting up the tasks on which it depends is your best bet.

+5
source

Source: https://habr.com/ru/post/1234857/


All Articles