简体   繁体   中英

How to create gradle project with multiple root project in spring boot

So the idea is to add a new gradle project in hierarchy, at root level. All spring-boot sub modules will extend its build.gradle.

  1. Should I use multiple build.gradle ?
  2. settings.gradle should contain multiple hierarchy. Is it possible ?

A sample hierarchy is described below to explain.

     -> b
    /
a ->
    \
     -> c

     -> q
    /
p ->
    \
     -> r

It's not entirely clear to me which hierarchy you mean.

If you mean the project structure hierarchy, in other words, to have a single Gradle build plan, in other words, have a single structure and a single gradlew execution to build both trees, that what you want is impossible. Citing the documentation , emphasis mine:

A multi-project build in gradle consists of one root project , and one or more subprojects that may also have subprojects.

The work-around, in this case, would be just stick another Gradle project on top of is, so that you have a proper root again:

           -> b
          /
      a ->
     /    \
    /      -> c
z ->
    \      -> q
     \    /
      p ->
          \
           -> r

If you mean to add two gradle roots to the root dir of a single git project, I suppose you could do that by using different xxx.gradle file names, but I think this will get very awkward to use, and I advise against it. Just use subdirectories.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM