Gradle wrapper to clone from github and build


(rtayek) #1

hi, i would like to make a gradle build file that would clone and build this project: https://github.com/Orego/Orego.

is this possible? (the project is an eclipse project).

i tried to use: classpath ‘org.ajoberstar:gradle-git:0.8.0’ in dependencies, but it says: A problem occurred evaluating root project ‘gorego’. > Could not find method classpath() for arguments [org.ajoberstar:gradle-git:0.8.0] on root project ‘gorego’.

the idea here is to eventually make this a gradle project, but how do i bootstrap the process of converting it?

thanks


(Peter Niederwieser) #2

Sounds like you made some mistake in the build script. Building an Eclipse project without writing a Gradle build for it will be difficult.


(rtayek) #3

i am confused. the build script is below. it was made by a gradle quickstart project. i was hoping to just get a clone task working.

apply plugin: 'java'
apply plugin: 'eclipse'
  sourceCompatibility = 1.5
version = 'alpha'
jar {
    manifest {
        attributes 'Implementation-Title': 'Orego with a GrdelWrapper', 'Implementation-Version': version
    }
}
  repositories {
    mavenCentral()
}
  dependencies {
    compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
    testCompile group: 'junit', name: 'junit', version: '4.+'
 classpath 'org.ajoberstar:gradle-git:0.8.0'
}

(Peter Niederwieser) #4

Repositories and dependencies for Gradle plugins need to be declared in a ‘buidscript {}’ block. For details, see the Gradle User Guide.


(rtayek) #5

i got the script below to work. so i have the clone.

thanks

import org.ajoberstar.grgit.*
apply plugin: 'java'
apply plugin: 'eclipse'
  sourceCompatibility = 1.8
version = 'alpha'
  buildscript {
 repositories { mavenCentral() }
 dependencies { classpath 'org.ajoberstar:gradle-git:0.8.0' }
}
  jar {
 manifest {
  attributes 'Implementation-Title': 'Orego with a GrdelWrapper', 'Implementation-Version': version
 }
}
  repositories { mavenCentral() }
  dependencies {
 testCompile group: 'junit', name: 'junit', version: '4.+'
}
  task clone {
 File dir=new File('orego')
 if(!dir.exists()) {
  def grgit = Grgit.clone(dir: dir, uri: 'https://github.com/Orego/Orego')
 }
}
  compileJava.dependsOn clone