forked from gradle/gradle
/
build.gradle.kts
42 lines (38 loc) · 1.21 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* This sample demonstrates the ability to selectively include projects
* from the local directory rather than using an external dependency.
*
* By default all projects are considered external and are picked up
* from the "repo" ivy repository. To include local projects in a build,
* set the "useLocal" system property on the gradle command line:
*
* gradle -DuseLocal=project1,project2 :showJarFiles
*
*/
plugins {
id("myproject.java-library-conventions")
}
// tag::project_substitution[]
configurations.all {
resolutionStrategy.dependencySubstitution.all {
requested.let {
if (it is ModuleComponentSelector && it.group == "org.example") {
val targetProject = findProject(":${it.module}")
if (targetProject != null) {
useTarget(targetProject)
}
}
}
}
}
// end::project_substitution[]
dependencies {
implementation("org.example:project1:1.0")
}
tasks.register("showJarFiles") {
val rootDir = project.rootDir
val compileClasspath: FileCollection = configurations.compileClasspath.get()
doLast {
compileClasspath.forEach { println(it.path.removePrefix(rootDir.path)) }
}
}