简体   繁体   中英

How to run .cmd file as task in Gradle?

I have .cmd file that I want to include everytime build.gradle is run by Android Studio.

Let's say the filename is create-artifacts.cmd and so in my module's build.gradle .

android {
    ...

    task createArtifacts(type:Exec) {
        commandLine = ["create-artifacts.cmd"]
        workingDir = file("$rootDir")
    }
}

How may I be helped with this?

See the ExecTask documentation

task createArtifacts(type:Exec) {
    commandLine 'cmd', '/c', 'create-artifacts.cmd'
    workingDir rootDir
}

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