Reputation: 5833
Without Gradle War Plugin, bootRepackage
task depends on jar
task but with Gradle War Plugin, it depends on war
task.
How can I change it to depend on jar
task even though I'm using Gradle War Plugin?
UPDATE:
I'm using war
task to create a war file including documents to be deployed to a documentation server and I want to use bootRepackage
d jar file to provide a service. My war
task depends on asciidoctor
task which depends on test
task (I'm using Spring REST Docs.) but I don't want to run asciidoctor
task or test
task when using bootRepackage
task.
I solved my 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 a sample project having the above configuration:
https://github.com/izeye/spring-boot-throwaway-branches/tree/war
Upvotes: 6
Views: 2458
Reputation: 116091
You should have been able to do this:
bootRepackage {
withJarTask jar
}
While this correctly causes the jar task's jar to be repackaged, it doesn't remove the dependency on the war task. This is another symptom of this Spring Boot issue.
Until this issue has been resolved, the approach that you've taken – declaring your own BootRepackage task and manually configuring the tasks that it depends upon – is your best option.
Upvotes: 7