Custom tasks in multi-project build

(william.r.phillips.jr) #1

I have a multi-project build with two libraries and many war projects.
All of the war projects depend on two library projects.

I have implemented a custom task (which does jar signing) called “signature”* that depends on java plugin “jar” task, and that is a dependency of the “assemble” task:


The war projects refer to the libraries with this syntax:

compile project(’:libraryA’)
compile project(’:libraryB)

When the wars are built, they run the libraryA and libraryB projects build up to the “jar” task but does not perform the “signature” task.

I can force the war task in the war projects to depend of the signature task:


But this seems inelegant.

Is there a better way to do this?

* the gradle jar signer plugin won’t work for me because I am not using an OpenPGP signature