Home » Posts tagged 'maven'
Tag Archives: maven
Adding Third Party Jars To An OSGI Bundle
Few days back I was writing a Spring Roo add-on(an OSGI bundle) which required me to add some external 3rd party jars to the OSGI bundle pom.xml file. I am not very well verse with OSGI so it took me some time to figure out how to add 3rd party jars to an OSGI bundle. In this short blog post I am sharing the recipe to add third part jars.
The exception that you get when OSGI bundle is not able to find the dependency is like this.
org.osgi.framework.BundleException: Unresolved constraint com.shekhar.roo.addon [66]: Unable to resolve 66.0: missing requirement [66.0] package; (package=com.shekhar.utils)
To solve this error you need to add Embed-Dependency tag to your maven bundle plugin as shown below. The example shows that I need to add commons-io and utils jar to my OSGI bundle. To get more information about Embed-Dependency tag and maven bundle plugin please refer to the documentation.
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.4</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Copyright>Copyright Shekhar Gulati. All Rights Reserved.</Bundle-Copyright>
<Bundle-DocURL>${project.url}</Bundle-DocURL>
utils,jsch,commons-io;scope=compile|runtime;inline=false</Embed-Dependency>
</instructions>
<remoteOBR>true</remoteOBR>
</configuration>
</plugin>
Hadoop Maven Archetype
Today, I found out the easiest way to generate a maven based Hadoop project using a maven archetype. This will generate a sample Hadoop project which uses hadoop version 0.20.2. The sample project also contains the famous WordCount example. To generate the maven project type following on the command line
mvn archetype:generate -DarchetypeCatalog=http://dev.mafr.de/repos/maven2/ -DgroupId=com.hadoop.example -DartifactId=hadoop-example
You can also get more information about the archetype at http://blog.mafr.de/2010/08/01/maven-archetype-hadoop/