简体   繁体   中英

How can I create a gradle task to generate exploded war with Sprint boot "bootWar" plugin?

I use the "org.springframework.boot" plugin and use the bootWar task to generate a war file of my spring boot project. I would like to have a task that creates an exploded version of this war file.

The standard way to do that with the 'war' plugin is :

task explodedWar(type: Sync) {
    into "${war.archivePath.parentFile.getAbsolutePath()}/exploded/${war.archivePath.name}"
    with war
}

How can i do the same thing with the spring-boot/bootWar plugin?

Try with:

task explodeBootWar(type: Sync) {
    dependsOn bootWar
    into "$buildDir/boot_war_exploded"
    from project.zipTree(bootWar.archiveFile)
}

You can use the with method on the normal war task because it is basically just a copySpec . However, the bootWar task does some additional things, so you have to build and unzip the actual archive.

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