0

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?

  • may be you dont have any feature defined.You can use this command to download all feature eclipse.exe -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -source http:/pathto/repository/updatesite/ -destination file:///d:/dev/artifactLocalRepository/ -verbose -ignoreErrors – Sandeep Mishra Mar 20 '17 at 10:22
  • I do not understand why you are trying to *install* Project2 instead of *including* it during the build? – not2savvy Mar 23 '17 at 09:50
  • @not2savvy we are not using Maven...so i think only solution left is using p2 director to install.... – DrunkenAvenger Mar 24 '17 at 04:21
  • If you are not using Maven, please explain what you use to run your build, so we don't have to guess. – not2savvy Mar 24 '17 at 12:05

2 Answers2

0

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
not2savvy
  • 2,902
  • 3
  • 22
  • 37
  • Thanks, but how to achieve above process using p2 director describe at this link: http://blog.vogella.com/2012/04/04/installing-eclipse-features-via-the-command-line-with-the-p2-director/ – DrunkenAvenger Mar 20 '17 at 05:34
  • I am not sure if I understand what you are trying to achieve with P2 director. As far as I understand, you have have references from Project1 to Project2 which need to be resolved during the build. For this, it is enough to refer to the Project2 repository during the Project1 build. I assume you use Tycho for the build? Please explain what you would want P2 director for. – not2savvy Mar 20 '17 at 11:10
0

I belive you are using maven for building your projects

  1. Build Project2

  2. Create p2 repository : You can use this maven plugin to create p2 repository.

  3. Upload it to Artifact Repository : Here we are using Nexus as Artifact Repository. Follow all the 10 steps under Setup Nexus as mentioned here.

I have created a reference pom.xml that could create a p2 repository and upload it to p2 repository.you can see it here.

  1. In your projectA, you can add feature site to your target platform that would point to projectB's p2 site.You can refer to vogella's article on Tycho here.