Search code examples
buildrcpnexustycho

Example how to build an eclipse RCP app with tycho against a nexus repository


Lars Vogel has a nice tutorial of how to build an eclipse plugin or rcp application with tycho (http://www.vogella.com/articles/EclipseTycho/article.html). This works well but there are two things I don't like. It builds against a repository that is somewhere and not in my control

  <repositories>
     <repository>
       <id>juno</id>
       <layout>p2</layout>
       <url>http://download.eclipse.org/releases/juno</url>
     </repository>
  </repositories>

and it does not show how the artifact can be used by another build. If possible I would like to build against a nexus repository where the target platform should be hosted and also the deployment of my build should be uploaded, so that another build can reference this as his target platform.

I have seen that there are some p2 plugins for nexus and also a nexus-unzip-plugin (https://bugs.eclipse.org/bugs/show_bug.cgi?id=393309) that can be used to navigate into an artifact but I have not enough knowledge to see how to stick these things together to be able building a eclipse plugin or rcp app against a nexus repository. Does someone one can show me the way to do that?


Solution

  • You should not need the nexus-p2-plugin. If you deploy your p2 repository as a zip file to your maven repository you should be able to use the unzip plugin. See the wiki page - http://wiki.eclipse.org/Tycho/Nexus_Unzip_Plugin for instructions on configuring it. I've extracted some of the steps here;

    1. Clone the repository (assuming git is installed)

      git clone git://git.eclipse.org/gitroot/tycho/org.eclipse.tycho.nexus.git

    2. Build the plugin (assuming maven is installed)

      mvn clean install

    -- See "Deploying the plug-in" in the wiki page

    1. Stop your nexus installation

    2. Unzip org.eclipse.tycho.nexus.git/target/unzip-repository-plugin--bundle.jar into your sonatype-work/nexus/plugin-repository/

    3. Start your nexus installation

    4. See "Configuring an unzip repository" in the wiki page

    5. If your main repository is public and you have created a virtual unzip repository called public.unzip, a deployed p2 repository zip available at e.g.

      http://<NEXUS_HOST>/nexus/content/repositories/public/org/example/demo/org.example.demo.repository/0.1.0/org.example.demo.repository-0.1.0.zip
      

    should be available as;

        http://<NEXUS_HOST>/nexus/content/repositories/public.unzip/org/example/demo/org.example.demo.repository/0.1.0/org.example.demo.repository-0.1.0.zip-unzip
    

    You should be able to use that URL as your p2 repository URL in your builds.