0

I need to migrate a multi-project build from maven to gradle and maintain the way inter-project dependencies and build order work. I'd like to use the maven plugin in gradle and continue to publish artifacts to both local and remote maven repositories.

The multi-project structure is like so:

root/
--Project-A/
----Project-A1/
----Project-A2/
--Project-B/
----Project-B1/
----Project-B2/

In maven Project-A2 has a dependency on Project-A1. If I run mvn install_ from the Project-A2 directory it will only build/install that project and pull it's dependency on Project-A1 from the local/remote maven repository. If I run mvn install from Project-A it will build/install both Project-A1 and A2 and calculate the build order based on the above mentioned dependency. How can this same behavior be achieved in gradle?

Additionally, Project-B2 has a dependency on Project-A2. If I run mvn install from the Project-B2 or Project-B directories this dependency should be pulled from the local/remote maven repository. If I run mvn install from the root directory it should calculate the build order such that Project-A1 builds, Project-A2 builds, and then _Project-B2 builds.

1 Answers1

0

That build order, as far as I know, isn't exactly possible with gradle. If you're building A2 and A1 has changed, gradle will build A1. If A1 hasn't changed then it won't be built. Same goes for the second scenario.

spy
  • 3,199
  • 1
  • 18
  • 26