Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I manage a 3rd party jar dependency with Eclipse, Maven and Jenkins?

We're trying to manage a project made of multiple Eclipse plug-ins.

One plug-in has a dependency to a 3rd party plug-in. It imports a class from a library named bpmn2. This library is a jar file and NOT included in the Maven remote repository.

Locally, in Eclipse, we have the library checked out into the workspace and referenced in the classpath of the Eclipse project. The plug-in manifest doesn't explicitly state the dependency to bpmn2. Which works locally...

We try to use Jenkins for continuous integration. The Multi-Plug-in-Project is managed using Maven and multiple POM files, using the Maven tycho plug-in.

The problem is that Maven doesn't care for the locally present library bpmn2 (of course). So we thought that using Maven install:install to install bpmn2 to the local Maven repository

./mvn install:install-file -Dfile=/home/someUser/bpmn2/org.eclipse.bpmn2_0.7.0.201111021300.jar -DgroupId=org.eclipse.bpmn2 -DartifactId=bpmn2 -Dversion=0.7.0 -Dpackaging=jar -DlocalRepositoryPath=/var/lib/jenkins/localRep/ 

and adapting the corresponding POM with a dependency entry for the library

<dependencies>
    <dependency>
      <groupId>org.eclipse.bpmn2</groupId>
      <artifactId>bpmn2</artifactId>
      <version>0.7.0</version>
      <type>jar</type>
    </dependency> 
  </dependencies>

would work. But it didn't.

The output of Maven is:

[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: modeltype.bpmn2 1.0.0.qualifier
[ERROR]   Missing requirement: modeltype.bpmn2 1.0.0.qualifier requires 'bundle org.eclipse.bpmn2 0.7.0' but it could not be found
[ERROR] 

The question is:

How could we better integrate the 3rd party library? The local classpath reference is not the optimal solution for the greater picture, I think. Should everyone who develops for the project install the bpmn2 library and only use the dependency in the manifest?

And what are we doing wrong with Maven? The local repository is

/var/lib/jenkins/localRep

and after installing the library to the repository, it seemed that the created dir structure was okay.

/org/eclipse/bpmn2/bpmn2/0.7.0/bpmn2-0.7.0.jar

Can somebody help?

like image 366
danowar Avatar asked Dec 17 '22 06:12

danowar


1 Answers

The simplest solution would be to set up a repository server for your company and proxy all your calls through that server.

I use Nexus from Sonatype.

It acts as a proxy when you need to download artifacts from remote locations, like maven central, but it also has an ability to setup repositories to store non-publcicly distributed artifacts.

The whole setup process is very well documented here -> http://www.sonatype.com/books/nexus-book/reference/.

Note, that open-source edition of the product is very good and is enough for your purposes.

Just to be fair, there is a competing product called Artifactory. You may read about it here -> http://www.jfrog.com/products.php

like image 172
Alexander Pogrebnyak Avatar answered May 18 '23 21:05

Alexander Pogrebnyak