How Create Gradle sharedManifest for multiple projects?
The easiest way to share manifest logic within a build is a configuration rule such as:
allprojects {
tasks.withType(Jar) { // includes War and Ear
manifest {
attributes ...
}
}
}
Also, there is another way to create a shared manifest:
Create a java.gradle file to keep configurations for Java subprojects and put inside:
ext.sharedManifest = manifest {
attributes(
.......
)
}
Then, in the root build.gradle apply this configuration for subprojects
subprojects {
apply from: "$rootDir/gradle/java.gradle"
.....
}
And there is possible to reuse this shared manifest and add extra attributes:
Subproject A:
jar {
manifest {
from sharedManifest
attributes(
'JavaFX-Application-Class': 'com.main.SomeClass',
.....
)
}
}