下载 Eclipse 插件更新站点以进行离线安装
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1371176/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Downloading Eclipse plug-in update sites for offline installation
提问by Chry Cheng
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 安装在未连接到 Internet 的机器上。有没有办法让我访问该站点(HTTP、FTP 等)以下载其中的文件以进行离线安装?
采纳答案by Robert Munteanu
Eclipse offers a way of mirroring these sites automatically, either through the command line or through ant tasks.
Eclipse 提供了一种通过命令行或通过 ant 任务自动镜像这些站点的方法。
Mirror based on p2 information
基于p2信息的镜像
$eclipse_home/eclipse -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -source -destination
$eclipse_home/eclipse -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -source -destination
Reference: Equinox p2 repository mirroring
Mirror based on site.xml information
基于site.xml信息的镜像
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.
您可以在我的脚本库中关注这些脚本的演变。
回答by Anton
After struggling with mirroring for some time, I realized that it is much easier (at least, for me) to use "wget" instead.
在努力镜像一段时间后,我意识到使用“wget”更容易(至少对我而言)。
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.
下载网站:
wget --recursive --no-parent http://url.of/updatesite
获取下载的更新站点的内容并将其移动到您的离线环境
- 通过“本地...”按钮将您的离线更新站点目录添加到可用软件站点列表中。
You can read about it with more details here.
您可以在此处阅读更多详细信息。
回答by Vineet Reynolds
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.
大多数 Eclipse 插件可以在没有 Eclipse 更新程序的情况下安装,方法是将更新站点上可用的所需 JAR 复制到 Eclipse 安装的 plugins 和 features 目录中。
In certain cases, it is necessary to start Eclipse with a -clean switch.
在某些情况下,需要使用 -clean 开关启动 Eclipse。
Here's an example of how to do this for the m2eclipse plugin:
以下是如何为 m2eclipse 插件执行此操作的示例:
- 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.
- m2eclipse 更新站点是http://m2eclipse.sonatype.org/update。确定所需的 JAR 列表是第一步。这通常可以在 site.xml 文件中找到;在这种情况下,您将在http://m2eclipse.sonatype.org/update/site.xml 中找到它。
- 过滤要下载到您打算使用的插件版本的 JAR 列表。这可以由每个“功能”的版本属性确定。如果幸运的话,您会在类别节点中找到 JAR 的描述。
- 注意需要下载的每个 JAR 的 url 属性。这将包括服务器上 JAR 可用的子目录,以及 Eclipse 安装中需要放置它们的目录。
PS: This method is a bit hackish, but it is based off the site-map reference. But do refer to the update
PS:这种方法有点hackish,但它基于站点地图参考。但请参考更新
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.
我还没有尝试过,但是您可以创建一个本地镜像站点,其他人都可以从该站点获取 Eclipse 插件。在 Galileo 中,这可以通过 mirror 命令以独立模式运行Eclipse 更新程序来完成。
回答by ILX
You can mirror p2 sites using Ant tasks:
您可以使用 Ant 任务镜像 p2 站点:
<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.
为了使其工作,您必须在与 Eclipse 相同的 JVM 中运行 ant 任务。
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.
您可以通过打开“软件更新”并从那里复制来找到 IU ID:s。在 Eclipse 3.5 中应该有一个更多...按钮,在 3.4 中你必须点击属性按钮。
回答by sancho21
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
Eclipse 插件通常依赖于其他插件。跟踪依赖关系有点困难。最好使用更新站点一次下载所有依赖项,您可以分发给其他 Eclipse 插件。对于 Eclipse 3.4 或更新版本,您可以使用 dropins,它是 Eclipse 的一个特性。这样您就不必每次重新安装 Eclipse 时都从更新站点安装插件。阅读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.
创建一个特殊的目录来保存我们喜爱的插件,例如在 /home/ichsan/eclipse-dropins 中,我们将安装 Maven 插件:m2eclipse。
mkdir /home/ichsan/eclipse-dropins
For now on, we'll call this directory as DROPINS
现在,我们将此目录称为 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.
接下来,我们将使用 Git 创建一个 Eclipse 沙箱。重点是在新的 Eclipse 上安装一个插件。与其每次要安装新插件时都安装新的 Eclipse,不如使用 Git 来创建新 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.
首先,将新的 Eclipse 提取/安装到一个目录中,例如 /home/ichsan/eclipse-sandbox(以便我们找到 /home/ichsan/eclipse-sandbox/eclipse.ini)。我们称该目录为 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.
现在是有趣的部分。假设我们必须安装 m2eclipse 插件。我们将在新的 Git 分支上安装它,以便主分支保持干净或完整。
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.
现在,我们启动 ECLIPSE_SANDBOX 的 Eclipse 并下载插件。完成后,我们关闭 Eclipse 并检查创建了哪些新目录或文件(使用 Git)。请记住,我们只关心新插件和功能目录以及其中的内容。因此,我们不会将其余部分复制到 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!
只需将 DROPINS/m2eclipse 的目录复制到 ECLIPSE_HOME/dropins 或创建一个符号链接。我们完成了!
cd $ECLIPSE_HOME/dropins ln -s $DROPINS/m2eclipse
Another way is to backup differences between fresh-Eclipse commit and after-plugin-installation commit.
另一种方法是备份新 Eclipse 提交和插件安装后提交之间的差异。
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
回答by Ian Jones
You can get it from here https://repository.sonatype.org/content/repositories/forge-sites/m2e/1.3.0/N/1.3.0.20121023-1108/
您可以从这里获取它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.
在 Eclipse 中转到帮助 | 安装新软件... 点击“添加”按钮 点击“本地...”按钮 浏览您将文件放入的目录。按照屏幕上的说明进行操作。
回答by PolyTekPatrick
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/manualfor install instructions and details.
我发现 p2 mirrorApplication 在某些站点上运行得不是很好,并且镜像了重复的工件(pack200 和 jar 版本)。b3 Aggregator 工作得更好,并且更容易定制我的更新站点。有关安装说明和详细信息,请参阅手册:https: //wiki.eclipse.org/Eclipse_b3/aggregator/manual。
The basic steps I used were:
我使用的基本步骤是:
- File > New > Other... > b3 > Repository Aggregation.
- Select the Aggregationnode and set the Build Rootto the folder where you want the aggregated repo to go.
- Add the platforms you care about using R-click the Aggregationnode > New Child > Configuration.
- Add one Validation Set, normally set its Labelto 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 Setas a Validation Repository, but typically you will need to add it as a Mapped Repositoryunder a Contributionso dependencies and/or additional eclipse features can be downloaded.
- For each plugin, add a Contributionwith a Label, and under that at least one Mapped Repositorywith a Location.
- Add Custom Categorynodes to the Aggregationif you want; give them each a unique Description, Identifier, and Label.
- Expand the Repository Browsernode 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.
- 文件 > 新建 > 其他... > b3 > 存储库聚合。
- 选择Aggregation节点并将Build Root设置为您希望聚合存储库所在的文件夹。
- 使用 R 键添加您关心的平台,单击聚合节点 > 新建子级 > 配置。
- 添加一个Validation Set,通常将其Label设置为 main。
- 如果您不需要来自主 eclipse 存储库的任何其他包(即:http: //download.eclipse.org/releases/mars),您可以将其添加到Validation Set作为Validation Repository,但通常您需要将其添加为贡献下的映射存储库,以便可以下载依赖项和/或其他 eclipse 功能。
- 对于每个插件,添加一个带有Label的Contribution,并在其下添加至少一个带有Location 的Mapped Repository。
- 如果需要,将自定义类别节点添加到聚合;给他们每个人一个唯一的Description、Identifier和Label。
- 展开底部的Repository Browser节点 > 展开 repo url > 展开Installable Units> 查看Categories(如果存在)和/或Features下的功能。
- 右键单击您想要的功能并添加到自定义类别(如果您正在使用这些),否则添加到父映射存储库为 > 映射功能。
- 右击任意节点 > 构建聚合。
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 Aggregationover time as new versions are released, the obsolete versions will accumulate in your aggregation. You could use Clean then Build Aggregationbut 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!
虽然 b3 Aggregator 通常只下载您映射的每个功能(及其依赖项)的最新版本,但如果随着新版本的发布,随着时间的推移反复使用Build Aggregation,过时的版本将在您的聚合中累积。您可以使用Clean 然后 Build Aggregation但这意味着您必须重新下载所有内容。相反,只需添加另一个 .b3aggr 聚合文件,设置构建根,添加您的配置,然后使用本地镜像final
目录的路径添加一个具有映射存储库的贡献。不要映射任何特征或创建任何类别。然后构建聚合,只会聚合来自您镜像的最新版本!
回答by Zhiyuan-Amos
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:
我刚刚遇到了这个问题,并按照本指南中的说明解决了它。总之,在终端的 Eclipse 文件夹中运行以下命令:
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
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:
where$1
指的是在线存储库的 URL,$2
指的是本地文件夹的路径。例如在我的 Windows 桌面上下载 Vrapper:
$1 = http://vrapper.sourceforge.net/update-site/stable/
$1 = http://vrapper.sourceforge.net/update-site/stable/
$2 = C:/Users/foo/Desktop
$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.
在没有 Internet 连接的情况下将文件夹传输到机器。然后,启动 Eclipse -> 帮助 > 安装新软件。为安装指定本地存储库(即您刚刚传输的文件夹)。那应该工作。