在 Eclipse 之外运行 P2 Ant 任务 [英] Running P2 Ant tasks outside Eclipse

查看:23
本文介绍了在 Eclipse 之外运行 P2 Ant 任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Eclipse 中运行良好的 ant 脚本这是其中的一部分:

<repository location="file:/${basedir}/compRepo" name="存储库描述在这里"/><添加><repository location="http://url/Eclipse/repo/Galileo-3.5.1/"/><repository location="http://another-url/Java/repo/4.0/"/><repository location="${diag.location}"/></添加></p2.composite.repository>

但是我希望 Hudson CI 服务器能够运行它,但是,无论我放入 ANT_HOME/lib 中的所有 jars 我都无法在简单的命令行 ant 中运行此任务...我被这个错误困住了:

C:\workspaces\workspace\project\junit.script\createCompRepo.xml:10: 问题:无法创建任务或输入 p2.composite.repository原因:名称未定义.行动:检查拼写.行动:检查是否已声明任何自定义任务/类型.行动:检查任何<presetdef>/<macrodef>已经进行了声明.

在哪里定义 p2 ant 任务?有没有办法在 Eclipse 之外运行它们?非常感谢您的帮助!安东尼

解决方案

通过阅读 此主题P2 Publisher 文档,应该是在 org.eclipse.equinox.launcher_*.jar

仅用于 -jar 参数的 P2 任务示例(此处不是 ant 任务):

java -jar /plugins/org.eclipse.equinox.launcher_*.jar-application org.eclipse.equinox.p2.publisher.UpdateSitePublisher-metadataRepository 文件:/<某个位置>/repository-artifactRepository 文件:/<某个位置>/repository-source/<location with a site.xml>-configs gtk.linux.x86-压缩- 发布工件

此处描述了 P2 Ant 任务,并在 Eclipse 帮助.

<小时>

OP Anthony43 在评论中添加:

<块引用>

我只想在 eclipse 之外运行一个带有 p2 taskdefs 的 ant 目标.
我发现我应该使用 antRunner,使用这样的命令行:

./eclipse -vm/opt/sun-java2-6.0/bin/java -nosplash \-data ${java.io.tmpdir}/workspace -consolelog \-应用程序 org.eclipse.ant.core.antRunner \-f/path/to/scripts/partialMirrorFromRepo.xml

但是 Andrew Niefer(PDE/Build、p2 和 Equinox 框架的 Eclipse 提交者)补充说:

<块引用>

p2 任务需要在 osgi 环境中运行,在正常的 ant 运行中无法运行.
这就是您需要使用 org.eclipse.ant.core.antRunner 应用程序的原因.以java -jar launcher.jar"开头只是调用 eclipse 可执行文件的另一种方法.

<小时>

martin jakubik 提及:

<块引用>

我希望看到一个可以剪切和粘贴并将所有内容组合在一起的命令.
我用的是:

java -jar \eclipse\plugins\org.eclipse.equinox.launcher_*.jar -application org.eclipse.ant.core.antRunner.

<块引用>

请注意,我无法弄清楚 是什么,所以我改用了 .

I got ant script running fine inside Eclipse Here is a piece of it :

<p2.composite.repository failOnExists="true">
            <repository location="file:/${basedir}/compRepo" name="Repository description goes here" />
            <add>
                <repository location="http://url/Eclipse/repo/Galileo-3.5.1/" />
                <repository location="http://another-url/Java/repo/4.0/" />
                <repository location="${diag.location}" />
            </add>
        </p2.composite.repository>

But I would like Hudson CI server to be able to run it, but, no matter all the jars I put in ANT_HOME/lib I can't get this task to run in a simple command line ant... I got stuck with this error :

C:\workspaces\workspace\project\junit.script\createCompRepo.xml:10: Problem: failed to create task or type p2.composite.repository
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

Where are defined the p2 ant tasks ? Is there a way to run them outside Eclipse ? Thank you very much for you help ! Anthony

解决方案

By reading this thread and the P2 Publisher documentation, it should be in org.eclipse.equinox.launcher_*.jar

Example of a P2 task (not an ant task here) just for the -jar argument:

java -jar <targetProductFolder>/plugins/org.eclipse.equinox.launcher_*.jar
 -application org.eclipse.equinox.p2.publisher.UpdateSitePublisher
 -metadataRepository file:/<some location>/repository
 -artifactRepository file:/<some location>/repository
 -source /<location with a site.xml>
 -configs gtk.linux.x86
 -compress 
 -publishArtifacts

The P2 Ant tasks are described here, and in the Eclipse help.


The OP Anthony43 adds in the comments:

I just want to run an an ant target with p2 taskdefs, outside of eclipse.
I found out that I should use antRunner, using such a command line :

./eclipse -vm /opt/sun-java2-6.0/bin/java -nosplash \
-data ${java.io.tmpdir}/workspace -consolelog       \
-application org.eclipse.ant.core.antRunner         \
-f /path/to/scripts/partialMirrorFromRepo.xml 

But Andrew Niefer (Eclipse committer on PDE/Build, p2, & Equinox Framework) adds:

The p2 tasks need to be run inside an osgi environment and won't work in a normal ant run.
That is why you need to use the org.eclipse.ant.core.antRunner application.
Starting with "java -jar launcher.jar" is just an alternate method to invoking the eclipse executable.


martin jakubik mentions:

I would have liked to see a command that I could cut&paste and that put everything together.
What I used was:

java -jar <eclipse-install-directory>\eclipse\plugins\org.eclipse.equinox.launcher_*.jar -application org.eclipse.ant.core.antRunner. 

Note that I could not figure out what <targetProductFolder> was, so I used <eclipse-install...> instead.

这篇关于在 Eclipse 之外运行 P2 Ant 任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆