Gradle: how to clone a git repo in a task?

后端 未结 5 1578
自闭症患者
自闭症患者 2020-12-08 15:08

Suppose I have a gradle build script and want to write a task to clone a remote git repository. How do I do that?

5条回答
  •  悲哀的现实
    2020-12-08 15:41

    With newer versions of gradle-git (0.7.0 and up), you would create the task like this:

    import org.ajoberstar.grgit.*
    
    task clone << {
      Grgit.clone(dir: file('build/repo'), uri: 'git@github.com:user/repo.git')
    }
    

提交回复
热议问题