Below is my code in build.gradle
`tasks.register("javaExe",JavaExec::class.java) {
main = "com.company.main"
val subproject = project(":utils").extensions.getByName("sourceSets") as SourceSetContainer
classpath = subproject["main"].runtimeClasspath
val baseDirectory = project.projectDir.absolutePath
val URL = environment["URL"]
val DBURL = environment["DBURL"]
val JREURL = environment["JREURL"]
args(baseDirectory, URL, DBURL, JREURL)
}
tasks.register("copydep",Copy::class) {
shouldRunAfter("javaExe")
//some copy task
}
tasks.register("runBuild") {
dependsOn("javaExe")
dependsOn("copydep")
doLast{
//some code
}
}`
when I run the runBuild task it should execute in order like javaExe,copydep and runBuild but the copydep task is not working always.
- I have verified the source and destination path location both are preset.
- when we remove the javaExe depandencies copy task working perfectly.