tags:

views:

485

answers:

1

Hi everyone ! 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

+3  A: 

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.

VonC
See also http://aniefer.blogspot.com/2009/08/versioning-p2-slides-from-eclipsecon.html
VonC
Hello ! thank you for your answer, but...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 /home/nboldt/eclipse/workspace-jboss/org.eclipse.dash.common.releng/tools/scripts/partialMirrorFromRepo.xml Thnaks anyway !
Anthony43
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.
Andrew Niefer
Yep, I totally agree, to finish with, launching an ant target with p2 tasks, one must use Eclipse or antRunner in an Equinox container.Thank you VonC,Anthony
Anthony43