0

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.

  1. I have verified the source and destination path location both are preset.
  2. when we remove the javaExe depandencies copy task working perfectly.
  • The order of execution of `dependsOn` is not guaranteed. See here: https://stackoverflow.com/questions/19682011/gradle-dependson-ordering – User51 Feb 14 '23 at 17:57
  • @User51 thats why i added shoudrunafter for javaExe. i guess that will do the ordering – tamizh ezhil Feb 15 '23 at 09:39

0 Answers0