Conditional include of subprojects


(niranjan.nanda) #1

Hi All,

I have a maven multi-module project with following structure. I am in the process of migrating to Gradle.

AppBuild
|--- Common (JAR module)
|
  |___ src/main/java
|
  |___ src/main/resources
|
  |___ src/test/java
|
  |___ src/test/resources
|
  |___ pom.xml
|
|--- Utils (JAR module)
|
  |___ src/main/java
|
  |___ src/main/resources
|
  |___ src/test/java
|
  |___ src/test/resources
|
  |___ pom.xml
|
|--- SOAPApis (WAR module)
|
  |___ src/main/java
|
  |___ src/main/resources
|
  |___ src/main/webapp
|
       |___ WEB-INF (etc)
|
  |___ src/test/java
|
  |___ src/test/resources
|
  |___ pom.xml
|
|--- RESTApis (WAR module)
|
  |___ src/main/java
|
  |___ src/main/resources
|
  |___ src/main/webapp
|
       |___ WEB-INF (etc)
|
  |___ src/test/java
|
  |___ src/test/resources
|
  |___ pom.xml
|
|--- pom.xml
  • We have multiple profiles inside AppBuild/pom.xml like shown below; and we run our maven build from AppBuild with -P option for the profiles
<profile>
  <id>soap-api</id>
  <modules>
    <module>Common</module>
    <module>Utils</module>
    <module>SOAPApis</module>
  </modules>
</profile>

Since I am new to Gradle, I am not able to decide what is the best way to go about it. Now, I am thinking to put some conditional “include” in settings.gradle based on some -P argument, but I am not too sure. Could someone help me how to go about this? What is the best way with some examples.

Thanks, ~ Niranjan


(Peter Niederwieser) #2

See my answer on Stack Overflow: http://stackoverflow.com/questions/20276941/gradle-conditional-include-of-subprojects

Please don’t double-post here and on Stack Overflow.