Search code examples
eclipsejenkinscommand-lineinstallationp2-director

P2 director for including one build into other project update site


I have 2 SVN repositories for projects say Project1 & Project2. Project1 is main application which uses Project2. What I am trying to achieve is whenever Project1 is built using Jenkins it should include the update site of Project2 and automatically build it and use in Project1.

The Project2 contains 6 projects & an update site(consists of artifacts.jar, content.jar. feature/, plugins/, site.xml).

How can I achieve this? Is eclipse P2 director can be used? If yes, then how? How to automate the process of incorporating Project2 update site in Project1?

UPDATE

In short, where to include Project2 update site in Project1, so as whenever Project1 is built it should automatically install Project2 using update site?

update site : /pathto/repository/updatesite/

contents of given link : artifacts.jar, content.jar. feature/, plugins/, site.xml

I am trying this command :

D:\EclipseCpp\eclipse\eclipsec.exe -application org.eclipse.equinox.p2.director -repository http:/pathto/repository/updatesite//  -installIU featurename -destination D:\EclipseCpp\eclipse\

but it failed stating that no feature name found.

UPDATE 1

So far what I achieved :

-> Successfully building Project1 using Jenkins.

-> Created a batch file which contains \Path_in\Project1\eclipsec.exe -application org.eclipse.equinox.p2.director -repository http:/pathto/repository/updatesite// -installIU featurename -destination \Path_in\Project1\eclipse .

This batchfile is installing Project2 in Project1 successfully now.

What I am trying to achieve is to again automate these steps i.e as soon as I finish building Project1 using Jenkins, it should trigger above command(may be some modification needed in command) from Jenkins to include Project2 in Project1. Is this possible?


Solution

  • Your Jenkins setup should have 2 jobs. Let'say, Jenkins job A builds Project1, and Jenkins job B builds Project2.

    (1) Set up job A to

    • build Project1

    (2) Set up job B to

    • build Project2
    • deploy the P2 artifacts, e.g. to a local directory /repo/project2/p2

    (3) In Project1, be sure to specify the above P2 directory as one repository in pom.xml, like so

      <repositories>
        <repository>
          <id>project2-p2repo</id>
          <url>file:/repo/project2/p2</url>
          <layout>p2</layout>
        </repository>
        [...] 
      </repositories>
    

    (4) Configure a build trigger in Jenkins job A:

    • Select Build after other projects are built
    • In Projects to watch, select Jenkins job B

    Done.

    Results will be:

    • When Project1 is built, it uses the P2 repository with the results from the Project2 build
    • When Project2 is built, a build of Project1 will be triggered with the new results from this the Project2 build