【发布时间】:2010-11-25 03:56:45
【问题描述】:
我要安装的插件提供了一个更新站点进行安装。但是,我想要安装的 Eclipse 安装在未连接到 Internet 的机器上。有没有办法让我访问该站点(HTTP、FTP 等)以下载其中的文件以进行离线安装?
【问题讨论】:
标签: eclipse plugins installation
我要安装的插件提供了一个更新站点进行安装。但是,我想要安装的 Eclipse 安装在未连接到 Internet 的机器上。有没有办法让我访问该站点(HTTP、FTP 等)以下载其中的文件以进行离线安装?
【问题讨论】:
标签: eclipse plugins installation
Eclipse 提供了一种自动镜像这些站点的方法,无论是通过命令行还是通过 ant 任务。
$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
参考:Equinox p2 repository mirroring
java -jar $eclipse_home/plugins/org.eclipse.equinox.launcher_*.jar -application org.eclipse.update.core.standaloneUpdate -command mirror -from $from -to $to
参考:Running the update manager from the command line
您可以在我的script repository 中关注这些脚本的演变。
【讨论】:
在与镜像斗争了一段时间后,我意识到使用“wget”来代替(至少对我而言)要容易得多。
简而言之:
下载网站:
wget --recursive --no-parent http://url.of/updatesite
获取下载的更新站点的内容并将其移动到您的离线环境中
您可以阅读更多详细信息here。
【讨论】:
http://download.eclipse.org/jubula/release/mars/。
大多数 Eclipse 插件无需 Eclipse 更新程序即可安装,只需将更新站点上可用的所需 JAR 复制到 Eclipse 安装的插件和功能目录中即可。
在某些情况下,需要使用 -clean 开关启动 Eclipse。
以下是如何为 m2eclipse 插件执行此操作的示例:
PS:这个方法有点hackish,但它基于site-map reference。但请参考更新
更新
我没有尝试过,但是您可以创建一个本地镜像站点,其他人都可以从该站点获取 Eclipse 插件。在 Galileo 中,这可以通过运行 Eclipse updater in the standalone mode via the mirror command 来完成。
【讨论】:
您可以使用 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>
或查找错误:
<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>
为了让它工作,你必须在与 eclipse 相同的 JVM 中运行 ant 任务。
您可以通过打开“软件更新”找到 IU ID:s 并从那里复制。在 Eclipse 3.5 中应该有一个 More... 按钮,在 3.4 中您必须单击属性按钮。
【讨论】:
Eclipse 插件通常依赖于其他插件。跟踪依赖关系有点困难。最好使用更新站点一次下载所有依赖项,然后您可以分发到其他 Eclipse 插件。对于 Eclipse 3.4 或更高版本,您可以使用作为 Eclipse 功能的 dropins。这样,您不必每次必须重新安装 Eclipse 时都从更新站点安装插件。继续阅读http://michsan.web.id/content/how-install-eclipse-plugins-offline
如果你看不到网页,我会给你一些描述
为外部插件准备目录
创建特殊目录来保存我们心爱的插件,例如在 /home/ichsan/eclipse-dropins 我们将安装 Maven 插件:m2eclipse。
mkdir /home/ichsan/eclipse-dropins
现在,我们将此目录称为 DROPINS
准备沙盒
接下来,我们将使用 Git 创建一个 Eclipse 沙箱。关键是在新的 Eclipse 上安装一个插件。与其每次要安装新插件时都安装新的 Eclipse,不如使用 Git 来创建新的 Eclipse 的新分支。
首先,将新的 Eclipse 解压/安装到一个目录,例如/home/ichsan/eclipse-sandbox(这样我们就可以找到 /home/ichsan/eclipse-sandbox/eclipse.ini)。我们将该目录称为 ECLIPSE_SANDBOX。
接下来,提交全新安装。这一步应该只做一次。
cd $ECLIPSE_SANDBOX
git init
git add .
git commit -am "Fresh Eclipse"
在沙盒上安装插件
现在是有趣的部分。假设我们必须安装 m2eclipse 插件。我们将把它安装在新的 Git 分支上,以便主分支保持干净或完好无损。
cd $ECLIPSE_SANDBOX
git checkout -b "m2eclipse"
现在,我们启动 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
只需将 DROPINS/m2eclipse 的目录复制到 ECLIPSE_HOME/dropins 或创建一个符号链接。我们完成了!
cd $ECLIPSE_HOME/dropins ln -s $DROPINS/m2eclipse
另一种方法是备份新 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
【讨论】:
你可以从这里得到它https://repository.sonatype.org/content/repositories/forge-sites/m2e/1.3.0/N/1.3.0.20121023-1108/
下载深入了解插件和功能的所有文件。存储在您机器上的目录中,将所有内容保持在相同的目录结构中。将其移动到您的开发机器上的文件夹中。
在 Eclipse 中转到帮助 |安装新软件... 点击“添加”按钮 点击“本地...”按钮 浏览您将文件放入的目录。按照屏幕上的说明进行操作。
【讨论】:
我发现 p2 mirrorApplication 在某些站点上运行不佳,并且镜像了重复的工件(pack200 和 jar 版本)。 b3 聚合器工作得更好,并且更容易自定义我的更新站点。有关安装说明和详细信息,请参阅手册:https://wiki.eclipse.org/Eclipse_b3/aggregator/manual。
我使用的基本步骤是:
重要提示:如果您不映射给定存储库中的任何功能,则整个存储库将被镜像(我认为是所有捆绑包的最新版本,而不是存储库中的所有内容)。
幸运的是,我不必弄乱排除规则或有效配置规则,这似乎使事情变得更加复杂。但是,如果存储库包含存在依赖冲突的捆绑包,则可能需要排除规则,在这种情况下,需要排除一个或多个冲突的捆绑包。
虽然 b3 Aggregator 通常只下载您映射的每个功能(及其依赖项)的最新版本,但如果您在新版本发布时反复使用 Build Aggregation,过时的版本将会累积在您的聚合中。您可以使用 Clean 然后构建聚合 但这意味着您必须重新下载所有内容。相反,只需添加另一个 .b3aggr 聚合文件,设置构建根目录,添加您的配置,然后使用本地镜像的 final 目录的路径添加一个带有映射存储库的贡献。不要映射任何特征或创建任何类别。然后 Build Aggregation,只会聚合镜像中的最新版本!
【讨论】:
我刚刚遇到了这个问题,并按照guide 的说明解决了这个问题。总之,在终端的 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
其中$1 指的是在线存储库的URL,$2 指的是本地文件夹的路径。例如。在我的 Windows 桌面上下载 Vrapper:
$1 = http://vrapper.sourceforge.net/update-site/stable/
$2 = C:/Users/foo/Desktop
将文件夹传送到没有 Internet 连接的机器。然后,启动 Eclipse -> 帮助 > 安装新软件。指定安装的本地存储库(即您刚刚转移的文件夹)。应该可以的。
【讨论】: