I understand what you are trying to do, it's what we have done. We have a
bunch of tasks that are injected into each modules build via the subprojects
{} solution I mentioned. My guess is that you are seeing a different
problem than you think. Defining a task in the root project does not
preclude a task with the same name in the subprojects. In fact, this is a
common occurance. What the error is complaining about is that
ejb-module-session already has a task named compileUnitTests. Are you
redefining that task in the ejb-module-session's build.gradle? Perhaps you
want to add some extra behavior that is specific to that module? Maybe post
a small snippet of your root project build.gradle where the compileUnitTests
task is defined and the ejb-module-session's build.gradle? That would help
to understand the issue.
Like I said, we are doing what you want: almost all behavior is defined in
the root project's build.gradle and injected into subprojects. This is
because we have a large number of modules in our system, and didn't want to
duplicate all that code. So, I think what you are wanting is possible (and
mostly easy) in Gradle. I just don't know what is holding you up right now.
--
John Murph
Automated Logic Research Team