devNoo

musings of a Software Developer

Mirroring eclipse update sites

| 2 Comments

When you have resticted internet access at work, dealing with eclipse plugins can be a pain.
A lot of plugins don’t make local-update archives anymore, so you have to look for other solutions. I had a look at epmt(http://code.google.com/p/epmt/) which is a nice, but not very stable application to mirror eclipse update sites. Unfortunately it uses apache httpClient to download source, while there is nothing wrong with this library, it doesn’t come with support for ntlm2 proxy authentication(java supports this from java 5 if i remember correctly so a bit strange it is not in there).

Apparently another way to mirror eclipse update sites is offered by the eclipse update manager itself.
You can start the update manager in a standalone mode to create a mirror of an update site by using
this command:

java -Dhttp.proxyHost=yourProxy -Dhttp.proxyPort=yourProxyPort -jar  plugins/org.eclipse.equinox.launcher_1.0.200.v20090520 -application org.eclipse.update.core.standaloneUpdate -command mirror -from %updateSiteToMirror% -mirrorUrl %urlOfYourUpdateSite% -to %fileLocationToMirrorTo%.

It even supports to create one mirror-site of multiple sites if you specify the same location for multiple sites it will append them to the site.xml giving you one big (and messy) update site.

An easy way to use this is use a dos or bash scipt ofcourse. I currently use the following script to mirror the relevant update site:

set LAUNCHER=C:\opt\springsource-2.1\sts-2.1.0.RELEASE\plugins/plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar

call updateSite http://subclipse.tigris.org/update_1.6.x subclipse
call updateSite http://pmd.sourceforge.net/eclipse pmd
call updateSite http://m2eclipse.sonatype.org/update/ m2eclipse
call updateSite http://findbugs.cs.umd.edu/eclipse/  findbugs
call updateSite http://moreunit.sourceforge.net/org.moreunit.updatesite/  moreunit
call updateSite http://www.springsource.com/update/e3.5 sprinsource-e35
call updateSite http://eclipse-cs.sf.net/update checkstyle
call updateSite http://update.atlassian.com/atlassian-eclipse-plugin atlassian
call updateSite http://commonclipse.sourceforge.net commonclipse
call updateSite https://ajax.dev.java.net/eclipse glassfish
call updateSite http://andrei.gmxhome.de/eclipse/ gmx-plugins
call updateSite http://regex-util.sourceforge.net/update/ regex
call updateSite http://ucdetector.sourceforge.net/update/ ucdetector

goto:eof

:updateSite
java -Dhttp.proxyHost=yourProxy	-Dhttp.proxyPort=yourProxyPort -jar %LAUNCHER% -application org.eclipse.update.core.standaloneUpdate -command mirror -from %1 -mirrorUrl http://server/eclipseupdatesite/%2 -to Y:\%2 &goto:eof
goto:eof

This gives us multiple update sites under http://server/eclipseupdatesite/ like http://server/eclipseupdatesite/m2eclipse etc. Of course you still need 1 computer to have unrestricted internet access, but you can always create those sites at home.

2 Comments

  1. Can you please send an Example Script as a Batch .bat for Windows ?

  2. Hi Jonas,

    you can just copy paste the code above in a .bat file, and it should work, if you fill in the proxy things and launcher variable.

    Cheers
    Job

Leave a Reply

Required fields are marked *.

*