Thursday, June 27, 2013

Downloading Eclipse Plug-In update sites for offline installation

Hi Everybody,

Because of working in a closed network without access to the Internet,
A need has emerged to provide an Eclipse update site location in the Local Network.

Eclipse by default provides the ability to install new software via  the IDE itself.





















But we could not get it as a separate package to be installed offline, so the way to install new plugins was to get an Eclipse installation in the Internet, download all the Plugins to it, and the enter the Eclipse package to the Inner Local Network.


There are some ways to do it, like most people do until now to take the jars from the plugins and features folders in the Eclipse IDE, and paste it to the same location in the wanted installation.
The next time they run Eclipse, they should run it with the "-clean" runtime parameter.

But there is a more elegant way to download a whole Update Site and host it as a location in the Local Network as a URL, for the standard way to install software to Eclipse.

The process is made with the Equinox p2 Repository Mirroring.
(There is a good explanation of the parameters in the Eclipse Wiki).

(You'll need an Eclipse Installation to run the script, I've tried it with Indigo-3.7, and Juno-4.2)

I've written a Windows Batch file that download an update site repository, from a given URL.

  1. @ECHO off
  2. SET ECLIPSE_HOME=" Location To the Eclipse Directory "
  3. SET SOURCE_URL=" Update Site URL " (e.g http://download.eclipse.org/eclipse/updates/4.2/)
  4. SET PLUGIN_NAME=" Directory Name of the Repository "
  5. SET LOCAL_REPOSITORY_ROOT=" Location the will hold all the update sites " (e.g "c:/update_sites/")
  6. SET DEST_URL=%LOCAL_REPOSITORY_ROOT%/%PLUGIN_NAME%
  7. c:
  8. MKDIR %LOCAL_REPOSITORY_ROOT%
  9. CD %LOCAL_REPOSITORY_ROOT%
  10. MKDIR %PLUGIN_NAME%
  11. ECHO Source Repository is: "%SOURCE_URL%"
  12. ECHO Destination Repository is: "%DEST_URL%"
  13. SET ARTIFACT_NAME=org.eclipse.equinox.p2.artifact.repository.mirrorApplication
  14. SET METADATA_NAME=org.eclipse.equinox.p2.metadata.repository.mirrorApplication
  15. %ECLIPSE_HOME%\eclipse.exe -nosplash -verbose -application %METADATA_NAME% -source %SOURCE_URL% -destination file:/%DEST_URL% -writeMode clean
  16. %ECLIPSE_HOME%\eclipse.exe -nosplash -verbose -application %ARTIFACT_NAME% -source %SOURCE_URL% -destination file:/%DEST_URL% -writeMode clean -raw -verbose -compare
  17. ECHO Finished downloading the Update Site
  18. @ECHO on
  19. PAUSE

You'll need to change all the places of the locations and the URL's to match your intent.
And copy the script and save it as a batch file of Windows,
Run the script, and wait....:)

The only downfall of it that it's really SLOW.
Think of it as installing all the Features in all of the Update Site and you'll get why it's slow.

The script actually downloads all of the Update Site without filtering specific features.
If you want to filter, and download specific features, you can try these two posts,
Equinox - p2 - Ant TasksLorenzo Bettini's Blog.

Finally,
You need to install the software in the Inner Local Network, as a local resource. (In the Red squares)
And find the location of the folder you've downloaded.
















Or you can host it on a server and give the people in your organization the URL to the location.

Good Luck!
I Hope it helps you,
Demi Ben-Ari