Why does WAR use manifest set for JAR?

I have multiproject build and it builds jars, wars and finally ears.
I added a line for manifests:

subprojects {
tasks.withType(Jar) {
destinationDir = file(dir_dist_libs)
exclude '**/*Test.class’
manifest { from ‘src/META-INF/MANIFEST.MF’ } // this line added
}
}
And now I get a build failure for WAR task:
File ‘/var/lib/jenkins/workspace/Gradle_build/Manager/extwar/src/META-INF/MANIFEST.MF’ does not exist

That manifest line caused this. I am confused, any explanation? The user guide says the WAR plugin disables the default JAR task but it does not say anything related to this kind of situation. Is this desired behaviour?

This was a silly one, I needed to use jar { manifest… }

The War type extends Jar so doing tasks.withType(Jar) will affect War tasks as well.

Thanks for pointing that out, I did not think of it that way. Still learning the idea that the script is actually code also :slight_smile: