11

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>

しかし、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.

p2 ant タスクはどこで定義されていますか? それらを Eclipse の外で実行する方法はありますか? 助けてくれてどうもありがとう!アンソニー

4

4 に答える 4

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

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       \
-application org.eclipse.ant.core.antRunner         \
-f /path/to/scripts/partialMirrorFromRepo.xml 

ただし、Andrew Niefer (PDE/Build、p2、および Equinox Framework の Eclipse コミッター) は次のように追加します。

p2 タスクはosgi 環境内で実行する必要があり、通常の ant run では機能しません
そのため、アプリケーションを使用する必要がありorg.eclipse.ant.core.antRunnerます。
「java -jar launcher.jar」で開始することは、eclipse 実行可能ファイルを呼び出す代替方法にすぎません。


マーティン・ヤクビクは次のように述べています。

カット アンド ペーストができ、すべてをまとめられるコマンドがあればよかったのにと思います。
私が使用したのは:

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

何が何であるかわからなかったので、代わり<targetProductFolder>に使用したことに注意してください。<eclipse-install...>

于 2010-02-24T16:42:21.600 に答える
2

その正確な目的のために小さなAntマクロを作成しました

<path id="equinox.launcher.path">
    <fileset dir="${eclipse.home}/plugins">
        <include name="org.eclipse.equinox.launcher_*.jar" />
    </fileset>
</path>

<macrodef name="antRunner">
    <!-- Ant script location -->
    <attribute name="antFile" />
    <!-- the arguments for the script that is executed -->
    <attribute name="args" default=""/>
    <sequential>
        <java 
            classname="org.eclipse.equinox.launcher.Main" 
            fork="true" 
            failonerror="true">

            <arg line="-application org.eclipse.ant.core.antRunner" />
            <arg line="-f @{antFile}" />
            <arg line="@{args}"/>
            <classpath refid="equinox.launcher.path" />
        </java> 
    </sequential>
</macrodef>
于 2013-11-05T09:07:55.500 に答える
1

すべての p2 タスクには eclipse ランタイムが必要です (上記の eclipse ヘルプで明示的に述べられているように)。したがって、eclipse を使用する必要があります。

それを回避する唯一の方法は、Eclipse コードを分析し、必要なものを抽出し、それを使用して独自のビルド システムを作成することです。

于 2012-04-28T22:03:27.903 に答える