简体   繁体   中英

Gradle: calling jar task

I want to implement a task which builds a jar. Another distribution task should call the jar task and the jar should output where the jar was generated. However the jar task is not called from mydist and the path printed is not created.

task myjar(type: Jar) {
    archiveName "my.jar"
    destinationDir = distribution_dir
    println 'jar ' + archiveName + ' created in ' + destinationDir
    manifest {
        attributes 'Main-Class': mainclass
    }
    with jar
}

task mydist << {
    myjar.execute()
}

如果要使“ myjar”在“ mydist”之前执行,然后在“ mydist”的声明之后执行:

mydist.dependsOn myjar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM