在Eclipse外部运行P2 Ant任务

Ant*_*nne 10 eclipse ant p2

我在Eclipse里面运行了很好的ant脚本以下是它的一部分:

<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>
Run Code Online (Sandbox Code Playgroud)

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

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.
Run Code Online (Sandbox Code Playgroud)

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

Von*_*onC 12

通过阅读此线程P2 Publisher文档,它应该在org.eclipse.equinox.launcher_*.jar

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

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
Run Code Online (Sandbox Code Playgroud)

P2 Ant任务在这里描述,并在Eclipse帮助.


OP Anthony43在评论中补充道:

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

./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 
Run Code Online (Sandbox Code Playgroud)

Andrew Niefer(PDE/Build,p2和Equinox Framework上的Eclipse提交者)补充道:

P2的任务需要在OSGi环境中运行,并且不会在正常运行蚂蚁工作.
这就是您需要使用该org.eclipse.ant.core.antRunner应用程序的原因.
从"java -jar launcher.jar"开始只是调用eclipse可执行文件的另一种方法.


martin jakubik提到:

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

java -jar <eclipse-install-directory>\eclipse\plugins\org.eclipse.equinox.launcher_*.jar -application org.eclipse.ant.core.antRunner. 
Run Code Online (Sandbox Code Playgroud)

请注意,我无法弄清楚是什么<targetProductFolder>,所以我使用了<eclipse-install...>.