# Multi-project builds with custom subproject build order?

**URL:** <https://discuss.gradle.org/t/multi-project-builds-with-custom-subproject-build-order/13884>\
**Category:** Help/Discuss\
**Created:** [January 18, 2016, 7:26pm UTC](https://discuss.gradle.org/t/multi-project-builds-with-custom-subproject-build-order/13884 "2016-01-18T19:26:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dalevine](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@dalevine](https://discuss.gradle.org/u/dalevine)\
**Post date:** [January 18, 2016, 7:26pm UTC](https://discuss.gradle.org/t/multi-project-builds-with-custom-subproject-build-order/13884/1 "2016-01-18T19:26:33Z")

</div>

I am a noobie to gradle/groovy so this may be an easy question.

I am porting an existing build system.

I need to create a multi-project gradle build for components consisting of a mixture of technologies and builds (Java, C++ and C#). For example, a component may need to compile a java project before building a C++ JNI component that requires header files produced by the java compiler, or it may consist of a common API/service compiled for each technology.  
There are hundreds of components and each is built independently.

I need to create a generic top-level gradle script that drives the build for each component. It will call into existing ant scripts, make and cmake files, or msbuild solutions.

This should be entirely data driven - ideally a configuration file at the root of each component’s repo specifies the subprojects and the dependencies between them. The common gradle script would drive all the subproject builds

A problem I ran into is that by default subprojects are built in alphabetical order - I need to be able to specify the build order.

I prefer to not specify dependencies in each project’s gradle script - this is difficult to manage and maintain across all the components.

What is the best way to do this? Is there any sample code out there that does this?

Thanks

---

<div class="post-metadata">

**Author:** ![etiennestuder](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/etiennestuder/32/7153_2.png) [@etiennestuder](https://discuss.gradle.org/u/etiennestuder)\
**Post date:** [January 19, 2016, 4:20am UTC](https://discuss.gradle.org/t/multi-project-builds-with-custom-subproject-build-order/13884/2 "2016-01-19T04:20:33Z")

</div>

Moved to the Gradle Core forum.

---

<div class="post-metadata">

**Author:** ![Kearny](https://avatars.discourse-cdn.com/v4/letter/k/73ab20/32.png) [@Kearny](https://discuss.gradle.org/u/Kearny)\
**Post date:** [July 14, 2020, 12:55pm UTC](https://discuss.gradle.org/t/multi-project-builds-with-custom-subproject-build-order/13884/3 "2020-07-14T12:55:03Z")

</div>

Hello,

Have you find a way to do custom subproject build with specific order ?

Thanks
