Multi level project configuration

settings.gradle

includeFlat “entsec_ldap:java:src:oracle:security:crypto:cert”

entsec_ldap/java/src/oracle/security/crypto/cert/build.gradle

sourceSets {

main {

java {

srcDir ‘project.projectDir’

}

}

}

Have sources under entsec_ldap/java/src/oracle/security/crypto/cert

but doing build from rootProject dir gives

Starting to execute task ‘:entsec_ldap:java:src:oracle:security:crypto:cert:compileJava’ 23:23:23.768 [INFO] [org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter] Skipping task ‘:entsec_ldap:java:src:oracle:security:crypto:cert:compileJava’ as it has no source files. 23:23:23.768 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ‘:entsec_ldap:java:src:oracle:security:crypto:cert:compileJava’ 23:23:23.769 [LIFECYCLE] [org.gradle.TaskExecutionLogger] :entsec_ldap:java:src:oracle:security:crypto:cert:compileJava UP-TO-DATE

How to specify sourceSet in multiproject

‘project.projectDir’ isn’t a String. You need to omit the quotes. Or maybe your code got scrambled. Please use HTML ‘<code>’ tags for all code and output.

entsec & entsec_ldap are directories at same level

entsec/settings.gradle

includeFlat "entsec_ldap:java:src:oracle:security:crypto:cert"

entsec_ldap/java/src/oracle/security/crypto/cert/build.gradle

sourceSets {

main {

java {

srcDir ‘.’

exclude ‘/.ade_path/

}

}

}

}

but gradle build from entsec directory is not able to find the build.gradle file in entsec_ldap/java/src/oracle/security/crypto/cert directory

10:16:37.222 [DEBUG] [org.gradle.configuration.BuildScriptProcessor] Timing: Running the build script took 5.569 secs 10:16:37.621 [INFO] [org.gradle.configuration.BuildScriptProcessor] Evaluating project ‘:entsec_ldap:java:src:oracle:security:crypto:cert’ using empty build file.

Interesting. I didn’t know you could embed sub-projects, using the ‘includeFlat’ notation, using colon characters. I knew it works with ‘include’ but I thought ‘includeFlat’ was different. I might need to try that and see if it works. This makes me wonder: what is really the difference between ‘include’ and ‘includeFlat’?

you may be right, in the sense, includeFlat cannot support “:” semantic, that is the reason gradle is not able to find the build.gradle.

Can you describe the directory layout in more detail? Why is ‘build.gradle’ located in ‘entsec_ldap/java/src/oracle/security/crypto/cert’, and not, say, in ‘entsec_ldap’? Also, isn’t ‘entsec_ldap/java/src’ the source root, with ‘oracle/security/crypto/cert’ being (part of) the package name of the code to be compiled?

That’s not the problem, but I first have to understand your directory layout. Your ‘includeFlat’ statement is probably not what you want.