3

After upgrading from gradle 5.x to 7.x, two war files generating.

Below are the 2 war file names

test-app-1.0.0.war
test-app-1.0.0-plain.war

below is gradle plugin and task used:

plugins {
    id 'war'
}

bootWar {
    launchScript()
    manifest {
        attributes 'Implementation-Version':  archiveVersion
    }
}

I want to generate only test-app-1.0.0.war. How to fix this?

Remo
  • 534
  • 7
  • 26
  • What happens if you don’t apply the `war` plugin? – Abhijit Sarkar Feb 10 '22 at 05:33
  • compile time error ```Could not find method bootWar() for arguments [] on root project 'test-app' of type org.gradle.api.Project.``` – Remo Feb 10 '22 at 05:37
  • That’s weird. Can you create a [minimum, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example)? – Abhijit Sarkar Feb 10 '22 at 06:21
  • You should apply the Spring Boot plugin not the war plugin. – M. Deinum Feb 10 '22 at 07:59
  • addding ```war { enabled = false }``` and ```bootWar { enabled = true launchScript() manifest { attributes 'Implementation-Version': archiveVersion } }``` generating without plain war. – Remo Feb 11 '22 at 03:24

1 Answers1

5

Based on the reference plain jar - stackoverflow:

Changed build.gradle like below

war {
    enabled = false
}

bootWar {
    enabled = true
    launchScript()
    manifest {
        attributes 'Implementation-Version':  archiveVersion
    }
}

Now it's generating only test-app-1.0.0.war

Remo
  • 534
  • 7
  • 26