SKM IT World

Just another blog about IT


Leave a comment

Migration Sonatype Nexus 2 to Nexus 3

I’d like to share my experience with migration Sonatype Nexus 2 to Nexus 3.

Starting Point

I used two Nexus instances:

  • A Nexus 2 Instance for Maven Repositories (2.13)
  • A Nexus 3 Instance for Bower Repositories (3.0.1)

Both instances had several types of repositories (host, proxy, group). The reason for this set up was that Sonatype recommended not to use Nexus 3 (pre 3.1) for Maven repositories and Nexus 2 doesn’t support Bower repositories.

Migration Path

  1. Update Nexus 2 instance to version 2.14.1 (Update Guide)
  2. Update Nexus 3 Instance to version 3.1 (Update Guide ). It’s important that you migrate to the new working directory layout.
  3. Follow the migration step for upgrading from version 2 to version 3 (Update Guide).
    • My scenario was Nexus 2 and Nexus 3 running on the same system.
    • I selected as Upgrade Method “File system copy”
    • I chose that only “repository configuration content” has to migrate.
  4. After a successful migration I had to adjust some configuration in Nexus and in the system that use Nexus:
    • Setup in Nexus 3 a new user for deploying artifacts.
    • Adjust URL to the repositories in Jenkins, Maven settings and deployment scripts.


1 Comment

Generate P2 Repository From Maven Dependencies

Motivation

If you use Maven Tycho to build your Eclipse RCP application, you can use Maven dependencies as you know it from Maven (for more information see [1]). I notice that Tycho takes many times for computing the target platform from the Maven dependencies during the build. I expect a speed up of build time if I use a P2 repository instead of Maven dependencies directly. Therefore, the task is how do I get the Maven dependencies to a P2 repository.

Procedure for generating a P2 repository from Maven dependencies

We generate the P2 repository with the help of some Maven’s plugin and some Maven Tycho’s plugin:

  • Builder Helper Maven Plugin
  • Maven Dependency Plugin
  • Maven Tycho’s P2 Extra Plugin
  • Maven Tycho’s P2 Plugin
  • Maven Tycho’s P2 Repository Plugin

Maven Tycho’s Plugins use Eclipse standard tools internally. How the Eclipse standard tools work are described well on this blog post [2]. Further useful information about Tycho’s plugins can be found in [3] and [4].

We create a POM project and configure plugins mentioned above, so that the following procedure can work:

  1. Define the Maven dependencies, that should be add to the P2 repository, in the <dependencies> section.
  2. Copy these defined dependencies to the source location of the Feature and Bundle Publisher with Maven Dependency Plugin.
  3. Generate P2 repository with P2 Extra Plugin.
  4. Add categories to the P2 metadata with P2 Plugin, so that you can see your P2 repository in Eclipse Target Platform Wizard.
  5. Zip P2 repository with P2 Repository Plugin.
  6. Attach zipped P2 repository to be installed and deployed in the Maven repository during the deploy phase with Builder Helper Plugin.

You can find the whole POM configuration in [5].

How to use zipped P2 Repository from Maven Repository

When you use Nexus as Maven Repository, you can use the Nexus Unzip Plugin ([6]).

Links

[1] Maven Tycho How to – Dependency on pom-first artifacts
[2] Blog Post about Generation P2 Repository with Eclipse Standard Tool
[3] P2 Extra Plugin Project Site
[4] Sonatype Wiki Page about P2 Extra Plugin
[5] POM Project on GitHub
[6] Nexus Unzip Plugin Documentation


2 Comments

Set up a Proxy P2 Repository with Nexus OOS

Assumption

I assume Nexus OOS in version 2.1.2 is installed. You can find a good tutorial in Sonatype’s Nexus book Repository Management with Nexus (Chapter 3: Installing and Running Nexus).

Preparation

For the set up of a proy P2 repository three Nexus plugins are needed:

  • Nexus Capability Plugin (It is contained  in the basic Nexus installation)
  • Nexus P2 Bridge Plugin 2.0.5 (Download)
  • Nexus P2 Repository Plugin 2.2  (Download)

It is important that you download the artifacts ending with -bundle.zip. Unzip both plugins in the directory $NEXUS_HOME/../sonatype-work/nexus/plugin-repository of your Nexus instance. Restart your Nexus instance. Then follow the instruction for creating a proxy P2 repository in the Sonatype Nexus book.

Troubleshooting

After I had created two proxy P2 Repositories, Nexus ran unstable. It restarted every night, automatically. A post in Nexus Mailing List advised me to increasing the heap space to 1024MB for a stable run with proxies P2 Repository:

  1. Open the config file $NEXUS_HOME/nexus/bin/jsw/conf/wrapper.conf.
  2. Edit the property wrapper.java.maxmemory.

Increasing the heap space to 1024MV solves my problem.

Links


Leave a comment

Distinctive Feature of Running Nexus on Linux

I installed Nexus on Linux according to the step-by-step instruction of Sonatype. Everything looked fine during the installation. To find out, whether the installation was successful, I tried to go to the welcome page of my nexus installation. I got an error message. I looked in the log file of Nexus and found following exception:

 com.google.inject.internal.ComputationException: com.google.inject.internal.ComputationException: java.lang.TypeNotPresentException: Type org.codehaus.enunciate.contract.jaxrs.ResourceMethodSignature not present
 ....

ERROR [er_start_runner] - /nexus - unavailable java.lang.IllegalStateException: The PlexusServerServlet couldn't lookup the target component (role='org.restlet.Application', hint='nexus')

With Google’s help I found a fixed bug in the Nexus bug tracking system, that describes my problem. The reason for my problem was:
I had on my Linux machine an IBM JVM in an elder version. With this version Nexus doesn’t run because of a bug in the IBM JVM.  Two solutions and one workaround exist for this problem:

  • Workaround: Copying enunciate-core-*.jar to /runtime/apps/nexus/lib.
  •  First solution: Update the version of IBM JVM to 5.0.0 SR12 / 6.0.0 SR8 FP1 or later
  •  Second solution: Use the JVM of Oracle.

I decided to change the JVM to an Oracle JVM and after that, Nexus ran without errors.

Links:

  1. Installation Guide for Nexus by Sonatype
  2. Bug reported to Nexus 
  3. Bug reported to IBM