There are few steps that need to be done to adding a third party jar to a JBI
component.  The first is to install the jar into maven with a command such
as this:

mvn install:install-file -DgroupId=com.mycompany -DartifactId=myjar
-Dversion=1.0 -Dpackaging=jar -Dfile=myjar.jar -DgeneratePom=true

The generatePom=true is important.  If the third party jar does not already
have a pom associated to it, then maven needs to do this in order to add it
to the jbi.xml file that eventually contains classpath entries needed by
your component to run.  If the component is in a maven repository that
already has a pom associated to it, then the generatePom=true can be left
off.

For compile time, this jar will also need to be added to the dependency
section of pom.xml of your component like the following:

<dependency>
   <groupId>com.mycompany</groupId>
   <artifactId>myjar</artifactId>
   <version>1.0</version>  
</dependency>

Now you can run mvn install, and it should build correctly and add to
jbi.xml a classpath entry for your third party jar.








Benamin wrote:
> 
> I can build ServiceMix components with third party jars, but I get errors
> at runtime, such as no class found errors.  It appears the jars do get
> packaged within the zip file that ServiceMix creates in the target
> directory. If I put the jars into the $SERVICEMIX_HOME/lib dir manually,
> it works, I don't get the NO class found errors.
> 
> Why does SMIX seem to ignore the jars it packages in the .zip file?
> 

-- 
View this message in context: 
http://www.nabble.com/runtime-error-when-referencing-third-party-jars-tf4098572s12049.html#a11658177
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to