Checkout using gradle script

牧云@^-^@ 提交于 2021-01-28 04:40:29

问题


I am new to gradle.I want to checkout remote repository using gradle script. It is possible to run shell command Inside gradle task to clone remote repository with datetime stamp shell commands.


回答1:


Yes, you can use a gradle Exec type task to execute any arbitrary command in the OS shell. See documentation and examples here.

You didn't say what type of repo you're using, but there is a gradle git plugin to do git operations including checkout.




回答2:


Here's an example of how we do it:

project.tasks.create(
    name: "checkOutCurrent", group: "Server", type:Exec,
    description: "Checks out the current commit on the remote server.") {
        workingDir project.rootDir

        commandLine 'git', 'checkout', this.commit
}


来源:https://stackoverflow.com/questions/35510512/checkout-using-gradle-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!