Friday, September 23, 2011

Cloning GitHub From Behind Proxy – Building Gradle From Source

How to clone a GitHub fork (Gradle in this case) from behind a proxy on a Windows machine without admin privileges…
  1. [Windows] Download Portable Git from: http://code.google.com/p/msysgit/downloads/list?can=3
  2. Follow instructions here:  http://help.github.com/win-set-up-git/
  3. Using git-bash: export http_proxy=http://proxyuser:passwd@proxy:port
  4. Setup /h/.ssh/config as per: http://stackoverflow.com/questions/5103083/problem-of-testing-ssh-in-git-behind-proxy-on-window-7
    ProxyCommand /c/dev/opt/git/bin/connect.exe -H proxy:port %h %p
    
    Host github.com
    User git
    Port 22
    Hostname github.com
    IdentityFile "/<userhome>/.ssh/id_rsa"
    TCPKeepAlive yes
    PreferredAuthentications publickey
    IdentitiesOnly yes
    
    Host ssh.github.com
    User git
    Port 443
    Hostname ssh.github.com
    IdentityFile "/<userhome>/.ssh/id_rsa"
    TCPKeepAlive yes
    PreferredAuthentications publickey
    IdentitiesOnly yes 


  5. git clone https://mattcallanan@github.com/mattcallanan/gradle.git gradle

    1. Provide proxy password
  6. Add the following to <project-dir>/gradle.properties:
        systemProp.http.proxyHost=proxy
        systemProp.http.proxyPort=port
        systemProp.http.proxyUser=username
        systemProp.http.proxyPassword=password
        systemProp.http.nonProxyHosts=myrepo|localhost
  7. If you have a hosted Maven repo, change gradle/build.gradle:
    ivy {
        // artifactPattern('http://repo.jfrog.org/artifactory/gradle-plugins-snapshots/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]')
        artifactPattern('http://myrepo/content/repositories/public/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]')
        ...
    } 


  8. [OPTIONAL] Proxy settings for For Ivy (not sure if this is necessary):


    • set ANT_OPTS=-Dhttp.proxyHost=proxy -Dhttp.proxyPort=port -Dhttp.proxyUserName=username -Dhttp.proxyPassword=password -Dhttps.proxyHost=proxy -Dhttps.proxyPort=port

  9. It seems minlog is in between com.esotericsoftware and com.googlecode, i.e. it’s moved but there’s still some old dependencies on esotericsoftware.  Download com.esotericsoftware:minlog:1.2 jar and pom, upload to your Maven repo, add repositories
    repositories {
        ...
        mavenCentral()
        mavenRepo(url: 'http://myrepo/content/repositories/public')
        ...
    }


Still working through some dependency issues attempting to build Gradle…