A plug-in that I want to install provides an update site for installation. However, the Eclipse installation that I want to install it to is on a machine that is not connected to the Internet. Is there a way for me to access the site (HTTP, FTP, etc.) to download the files in it for offline installation?
Eclipse offers a way of mirroring these sites automatically, either through the command line or through ant tasks.
Mirror based on p2 information
$eclipse_home/eclipse -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -source $1 -destination $2
$eclipse_home/eclipse -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -source $1 -destination $2
Reference: Equinox p2 repository mirroring
Mirror based on site.xml information
java -jar $eclipse_home/plugins/org.eclipse.equinox.launcher_*.jar -application org.eclipse.update.core.standaloneUpdate -command mirror -from $from -to $to
Reference: Running the update manager from the command line
You can follow the evolution of these scripts in my script repository.
After struggling with mirroring for some time, I realized that it is much easier (at least, for me) to use "wget" instead.
In short:
Download the site:
wget --recursive --no-parent http://url.of/updatesite
Take the content of the downloaded update site and move it to your offline environment
Add your offline update site directory to the list of available software sites via "Local..." button.
You can read about it with more details here.
Most Eclipse plug-ins can be installed without the Eclipse updater, by copying the required JARs available at the update site, into the plugins and features directories of the Eclipse installation.
In certain cases, it is necessary to start Eclipse with a -clean switch.
Here's an example of how to do this for the m2eclipse plugin:
The m2eclipse update site is http://m2eclipse.sonatype.org/update. Identifying the list of JARs required is the first step. This is normally found in the site.xml file; in this case, you'll find it in http://m2eclipse.sonatype.org/update/site.xml.
Filter the list of JARs to be downloaded to the version of the plugin that you intend to use. This can be determined by the version attribute for each "feature". If you are lucky, you'll find the description of the JAR in the category node.
Note the url attribute of each JAR that needs to be downloaded. This will include the subdirectory on the server where the JAR is available, and also the directory in the Eclipse installation where they need to be placed.
PS: This method is a bit hackish, but it is based off the site-map reference. But do refer to the update
Update
I haven't attempted this, but you can create a local mirror site, from where everyone else can pickup the Eclipse plug-ins. In Galileo, this can be done by running the Eclipse updater in the standalone mode via the mirror command.
You can mirror p2 sites using Ant tasks:
<target name="springide">
<echo>springide</echo>
<p2.mirror verbose="true">
<repository location="${REPO_HOME}/springide" name="springide" append="true"/>
<source>
<repository location="http://springide.org/updatesite" />
</source>
<iu id="Core / Spring IDE" version="" />
<iu id="Extensions / Spring IDE" version="" />
<iu id="Integrations / Spring IDE" version="" />
<iu id="Resources / Spring IDE" version="" />
</p2.mirror>
</target>
or findbugs:
<target name="findbugs">
<echo>findbugs</echo>
<p2.mirror verbose="true">
<repository location="${REPO_HOME}/findbugs" name="findbugs" append="true"/>
<source>
<repository location="http://findbugs.cs.umd.edu/eclipse/" />
</source>
<iu id="edu.umd.cs.findbugs.plugin.eclipse.feature.group" version="" />
</p2.mirror>
</target>
In order for this to work you have to run ant tasks in the same JVM as eclipse.
You can find IU ID:s by opening "Software Updates" and copy it from there. In Eclipse 3.5 there should be a More... button, in 3.4 you have to click on properties button.
Eclipse plugins usually depend on other plugins. It's kind of hard to trace the dependencies. It's better to download all dependencies using update site once, and you can distribute to other Eclipse dropins. For Eclipse 3.4 or newer, you can use dropins which is an Eclipse feature. This way you don’t have to install plugin from update site every time you have to re-install your Eclipse. Read on http://michsan.web.id/content/how-install-eclipse-plugins-offline
If you can't see the web, I'll give you some description
Prepare directory for external plugins
Create special directory to hold our beloved plugins, e.g. in /home/ichsan/eclipse-dropins we will install Maven plugin: m2eclipse.
mkdir /home/ichsan/eclipse-dropins
For now on, we'll call this directory as DROPINS
Preparing sandbox
Next, by using Git we'll create an Eclipse sandbox. The point is to install one plugin on a fresh Eclipse. Instead of installing fresh Eclipse every time we want to install a new plugin, we'd better use Git to create new branch of fresh Eclipse.
First, extract/install new Eclipse to a directory e.g. /home/ichsan/eclipse-sandbox (so that we'll find /home/ichsan/eclipse-sandbox/eclipse.ini). We call the directory as ECLIPSE_SANDBOX.
Next, commit the fresh installation. This step should be done once only.
cd $ECLIPSE_SANDBOX
git init
git add .
git commit -am "Fresh Eclipse"
Install plugin on sandbox
Now is the interesting part. Supposed we have to install m2eclipse plugin. We will install this on new Git branch so that the master branch will stay clean or stay intact.
cd $ECLIPSE_SANDBOX
git checkout -b "m2eclipse"
Now, we start the Eclipse of the ECLIPSE_SANDBOX and download the plugin. Once we're done, we shut the Eclipse down and check what new directories or files have been created (using Git). Remember that, we only care about new plugins and features directories and the contents inside them. So, we won't copy the rest into dropins.
# Prepare the m2eclipse plugin directories
mkdir -p $DROPINS/m2eclipse/eclipse/plugins
mkdir -p $DROPINS/m2eclipse/eclipse/features
cd $ECLIPSE_SANDBOX
for f in $(git status | sed "s/#\t//g" | grep -P "^plugins" ); do cp -R $f $DROPINS/m2eclipse/eclipse/plugins; done
for f in $(git status | sed "s/#\t//g" | grep -P "^features"); do cp -R $f $DROPINS/m2eclipse/eclipse/features; done
# Make the directory read only
chmod -R -w $DROPINS/m2eclipse
# Commit changes
git add .
git add -u
git commit -am "M2Eclipse plugin installed"
# Back to master branch to make Eclipse clean again and ready for other plugin installations
git checkout master
Installing the plugin
Just copy the directory of DROPINS/m2eclipse into ECLIPSE_HOME/dropins or create a symbolic link. And we're done!
cd $ECLIPSE_HOME/dropins ln -s $DROPINS/m2eclipse
Another way is to backup differences between fresh-Eclipse commit and after-plugin-installation commit.
for i in `git diff hashFreshEclipse hashPluginInstall --name-only`;do
if [ -f $i ]; then
tar -r -f m2e-android.tar $i
fi
done
gzip m2e-android.tar
You can get it from here https://repository.sonatype.org/content/repositories/forge-sites/m2e/1.3.0/N/1.3.0.20121023-1108/
Download all files drilling down into plugins and features. Store in a directory on your machine keeping everything in the same directory structure. Move it to a folder on your dev machine.
In Eclipse go to Help | Intall New Software...
Hit the 'Add' button
Hit the 'Local...' button
Browse for the directory you dropped the files into. Follow the on screen instructions.
I found that the p2 mirrorApplication did not work very well on some sites and mirrored duplicate artifacts (both the pack200 and jar version). The b3 Aggregator worked much better and made it much easier to customize my update site. See the manual at: https://wiki.eclipse.org/Eclipse_b3/aggregator/manual for install instructions and details.
The basic steps I used were:
File > New > Other... > b3 > Repository Aggregation.
Select the Aggregation node and set the Build Root to the folder where you want the aggregated repo to go.
Add the platforms you care about using R-click the Aggregation node > New Child > Configuration.
Add one Validation Set, normally set its Label to main.
If you don't need any additional bundles from the main eclipse repository (ie: http://download.eclipse.org/releases/mars), you can add it to the Validation Set as a Validation Repository, but typically you will need to add it as a Mapped Repository under a Contribution so dependencies and/or additional eclipse features can be downloaded.
For each plugin, add a Contribution with a Label, and under that at least one Mapped Repository with a Location.
Add Custom Category nodes to the Aggregation if you want; give them each a unique Description, Identifier, and Label.
Expand the Repository Browser node at the bottom > expand the repo url > expand the Installable Units > Look at the features under Categories (if present) and/or under Features.
R-click the features you want and Add to Custom Category (if you are using those), otherwise Add to parent mapped repository as > Mapped Feature.
R-click any node > Build Aggregation.
Important Note: if you don't map any features from a given repository, that entire repository will be mirrored (the latest versions of all bundles I think, not actually everything in the repo).
I fortunately didn't have to mess with Exclusion Rules or Valid Configuration Rules, which seem to make things more complicated. However, exclusion rules may be necessary if the repositories contain bundles that have dependency conflicts, in which case one or more conflicting bundles need to be excluded.
While b3 Aggregator normally only downloads the latest version of every feature you have mapped (and it's dependencies), if you repeatedly use Build Aggregation over time as new versions are released, the obsolete versions will accumulate in your aggregation. You could use Clean then Build Aggregation but this means you will have to redownload everything. Instead, simply add another .b3aggr aggregation file, set the Build Root, add your Configurations, and add one Contribution with a Mapped Repository using the path to your local mirror's final directory. Don't map any features or create any categories. Then Build Aggregation and only the latest versions from your mirror will be aggregated!
I just faced this issue and resolved it by following the instructions from this guide. In summary, run the following commands on your terminal in Eclipse folder:
eclipsec.exe -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -source $1 -destination $2
eclipsec.exe -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -source $1 -destination $2
Where $1 refers to the URL to the online repository and $2 refers to the path to the local folder. E.g. to download Vrapper on my Windows Desktop:
$1 = http://vrapper.sourceforge.net/update-site/stable/
$2 = C:/Users/foo/Desktop
Transfer the folder to the machine without Internet connection. Then, launch Eclipse -> Help > Install new software. Specify the local repository (i.e. the folder that you've just transferred) for the installation. That should work.
Related
I'm creating a product based on Eclipse 3.6.2 for our project. The idea is to create an Eclipse installation that has all the plugins we require and all configuration are setup as we need them for the project.
As part of that, I want to make sure our update sites are included, but how can I do that?
If I choose to export preferences update sites are not included. I can export update sites from the preference page and get an XML file with them, but how can I include it in my config.ini file? Or is there some other way?
Goal is, when the user runs the custom Eclipse product our update sites will be in the list of sites. Ideally, the only ones in the list.
You can add a p2.inf file that instructs particular update sites when things are installed:
instructions.configure=\
addRepository(type:0,location:http${#58}//www.eclipse.org/equinox/p2/testing/updateSite);\ addRepository(type:1,location:http${#58}//www.eclipse.org/equinox/p2/testing/updateSite);
This would add www.eclipse.org/equinox/p2/testing/updateSite.
This file (p2.inf) needs to go in the same directory as your MANIFEST.MF file. You can read more about this here.
Since there is a likely chance I'll have to do this again, and no chance I remember how to do it the next time, I'll write down the steps I went through:
I created a p2.inf file with instructions;
instructions.configure=\
org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(type:0,location:http${#58}//<my_url_here>,name:<my_name_here>,enabled:true);\
org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(type:1,location:http${#58}//<my_url_here>,name:<my_name_here>,enabled:true);\
org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(type:0,location:http${#58}//<my_url_here>,name:<my_name_here>,enabled:true);\
org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(type:1,location:http${#58}//<my_url_here>,name:<my_name_here>,enabled:true);`
According to the Eclipse wiki the inf-file could be placed in the same dir as my feature.xml, so that's what I did.
I had a product that consisted of this feature, so I exported the product using Eclipse product export wizard. I made sure to build a repository.
After the build was done, the repository had a content.jar. Inside the content.jar there was a content.xml. Examining it, I could find:
<touchpointData size='1'>
<instructions size='1'>
<instruction key='configure'>
org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(<all my update sites>);
</instruction>
</instructions>
</touchpointData>
So this verified that the export did actually see my p2.inf file and do something with it.
To install from the repository I used an Eclipse Director script:
cmd /c "C:\Program\Eclipse\director\director -consoleLog -bundlepool c:/program/eclipse/eclipse3.6_custom -profileProperties "org.eclipse.update.install.features=true" -i MyProduct.Product -r "file:/C:\eclipse\exported\repository" -d c:/program/eclipse/eclipse3.6_custom -p helios"`
The script installed the product from the repository to the destination.
How can I know and download all plugin dependencies so that I could install it later offline
without the need of internet
Thanks
You can use the p2 mirror facility to create a local copy of the p2 repos you need. Then you can install it later off line.
I use ant mirror scripts to mirror p2 repos (ex: mirror-jface.xml), and they can be run like:
bash$ eclipse/eclipse -noSplash \
-application org.eclipse.ant.core.antRunner \
-DbaseDir=/some/useful/basedir -buildfile mirror-jface.xml
You have to specify all of the repositories to search in order to pick up all the dependencies.
If you start off by installing the plugin online, then open up the folowing view:
Window->Show View->Other->Plug-in Development->Plug-in Registry
In that view find the plugin(s) you're interested in, expand them, and make a note of all the pluigns under the "Prerequisites" section. Note that it only lists direct dependencies, so you may need to follow these down to find the whole dependency hierarchy.
Quite a manual process, and hopefully someone else can point out an easier way, but this should give you a full list of plugins that you can then install offline.
What could cause Eclipse to ignore plugins in the dropins catalog?
I've created a dummyplugin based on the Eclipse wizard, exported it to a jar. When dropping it into the drop-ins catalog of a fresh Eclipse installation, it works fine.
When I do the same thing but on a custom Eclipse installation, it doesn't work. The plugin doesn't even show up in the plugin registry view. No error messages or anything like that.
I've tried:
Running with -clean
Running with -clean -consoleLog but no errors were printed
Starting up with -console, and checking if the plugin is seen with the command ss, no luck.
Running with -Dorg.eclipse.equinox.p2.reconciler.dropins.directory=C:\Program\Eclipse\eclipse3.6\dropins\
Changing name of the eclipse catalog from eclipse3.6 to eclipse, in case I had run into a variation of an Eclipse bug
It's not due to dependency issues (like this question), since the plugin isn't even found
Update Copied the eclipse.ini from the working eclipse installation to the custom one, with the same result; The plugin wasn't found. So the issue isn't in the ini file
Update Thought the issue might be some rights issue, since I my user wasn't the owner of the custom installation. So I made a copy of the entire dir of the custom installation to make sure I was the owner with full rights. No change
Update Starting with a new workspace doesn't make any difference
Is it possible to define that Eclipse should ignore the dropins catalog? How?
The custom version of Eclipse defines a lot of variables, but nothing that seems related to p2 or the behaviour of dropins.
The dropins/ folder is a best effort, totally optional, silently failing legacy leftover. Not big on the diagnostics, as you've found.
If you use the director to install your bundle into your custom eclipse, at least you'll be able to get an error message that will tell you what the problem is.
I'd suggest exporting your jar with some minimal p2 metadata.
Then you use something like:
eclipse/eclipse \
-application org.eclipse.equinox.p2.director \
-noSplash \
-repository \
file://$HOME/eclipseUpdate \
-installIUs \
org.dojotoolkit/1.6.1.v201105210659
If p2 can't find some dependency, it should spew out the confusing error messages it can generate.
Hi #Fredrick I've made my own plugin and I've added to my eclipse in this way:
Export the plugin as Deployable plug-ins and fragements.
(Right click on the plugin project - Export - Plugin Development - Deployable plug-ins and fragements)
That will generate a .jar file that file you have to copied into \eclipse\plugins
Restart eclipse.
I'd say that will be all.
With the p2 ant tasks, it's pretty simple to mirror the plugins for a feature.
But how do I mirror everything necessary to install a feature?
Couldn't get p2.mirror working; the task either mirrors too much (like all versions of a feature even if you're only interested in the last or a specific one) and/or too little (like just the feature but none of the dependencies).
My solution was like this:
Unpack Eclipse to eclipse-template
Create a copy as eclipse-install
Install the feature in eclipse-install
Delete any file in the copy which exists in the version from step #1 (cd eclipse-template ; find . -type f -exec rm "../eclipse-install/{}").
That leaves you with the feature and plugin files. Use org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher to turn that into a p2 repo (see the docs for details).
[UPDATE 2011-11-01] There is another solution if you don't need to run this from the command line.
Create a "Target Definition" in an Eclipse project (create a new one or use an existing one, doesn't matter)
Add update sites to this *.target file
Select the features you want
Click on the tiny "Export" button in the top right corner of the Target Definition Editor (next to "Set as Target Platform")
That will export all the selected features with the exact version that you selected plus all dependencies in a folder of your choice.
The target editor is a bit clumsy and slow but it works.
Keep the file under version control because the target editor sometimes messes up.
I am using the following Ant code to mirror 2 features in a single repository:
<!-- Creates single p2 repo from 2 repos -->
<p2.mirror>
<repository location="file:///${DESTINATION}/repo-name" append="false"/>
<source>
<repository location="file:///${feature1-repo}/feature1"/>
<repository location="file:///${feature2-repo}/feature2"/>
</source>
</p2.mirror>
Moreover you can use the <iu> and the feature's id to specify the feature to be mirrored. Features id must be specified in the following way:
your.feature.id.group.group.group
If you have specific plateform configurations for your feature, then the IU becomes
your.feature.id.win32.win32.x86 (OS, Widget system, Architecture)
I'm trying to share multi-module Maven project (using m2eclipse plug-in) from SpringSource Tool Suite 2.0.0 to Subversion server (Subversive plug-in for Eclipse). I've found that svn:ignore property is not propagated to submodules of the parent project: I need to right-click on the property and run "Apply recursively...". More, it won't work if root folder of submodule is not in SVN repository yet: first of, I need to check-in root folder, then right-click on the property and run "Apply recursively...".
Am I missing something? Please, describe your way of ridding of the problem.
P.S. The project has nested structure:
PARENT
+ component A
- module AA
- module AB
+ component B
- module BA
+ component C
- module CA
- module CB
- module CC
If the Eclipse plugin 'Subversive' GUI is not advanced enouggh to support the kind of property setting you want, may be a command line would be more efficient.
cd PARENT
ls -s | xargs svn propset -R -F ignore.txt svn:ignore
That way, you apply svn:ignore only on already committed directories (and sub-directory) without having to commit first PARENT.
If you are on Windows, a package like GnuWin32 can help (or there is multiple alternative, like PowerShell)