简体   繁体   中英

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM