I am working on writing a custom plugin that does some post processing of a Jar. The plugin basically runs Websphere’s
ejbdeploy utility to generate some EJB-specific class files. It requires that the source and output JARs to be different.
I originally tried to do this by putting my exec task as the finalizer task (
finalizedBy) of the jar task. While this works, its not ideal because I must first rename the original jar and then create a new one. This messes up the jar task’s up-to-date functionality and these tasks run every time i build my multi-project. I also tried to setup the task dependencies but because I have an Ear that is being generated in another sub-project, I would have to somehow make the ear task dependent on my ejbdeploy task (something I cant figure out how to do cleanly).
Another alternative solution is to simple execute the rename and exec tasks as actions in a
doLast closure on of the jar task. But I’ve read in numerous places that this is not ideal.
Conceptually, the actions I am doing (renaming and then executing a command line program) do not necessarily need to be tasks themselves. Such actions are really a part of the jar task for sub-projects that need this kind of post processing done. So I think I really want these things to be simple actions that are done as part of the jar task. These are tasks only because it was easier to write them that way.
Is my logic sound? Should these really not be tasks and just actions as part of the
doLast closure of the jar task?