Short Introduction
The last 6 month I was at a customer where I did Lotus Notes app maintenance and lots of Java development.
Especially the Java part is very interesting. I feld I entered another world, the world of ‘real’ java 😉
In the projects I worked with Maven, Jenkins, CheckStyle, Unit test frameworks like Mockito, FindBugs and Spring Framework.
Power of Maven dependency
Currently in my spare time I am developing a OSGi plugin and I was thinking to reuse the knowledge of Maven.
In this Plugin I use the Codehaus Jackson ObjectMapper, to convert JSON immediately to a Java Object. Is a very useful project.
As you look at the website of Codehaus, there are 3 jar files. The core, databind and streaming. For the ObjectMapper you need the Databind part. But in my opinion it is not so clear if you need also the core.
So IÂ started by importing by only the Databind Jar file to my Plugin project. But there was some dependency, because Eclipse was complaining.
To be on the save side, I imported the Core and Streaming to the plugin project. It will work, but maybe I have included to much and make my project unnecessary to big.
To not touch the Plugin code and keep it as backup, I have created a brand new Maven Project, so inclusive the ‘famous’ pom.xml.
First thing to do is find the dependency xml for the Jackson ObjectMapper. Search.Maven.org is your friend, on this side you can find almost all public available dependencies. In my case here you can find the dependency.
Copy the Apache Maven dependency code and paste it in your pom.xml between dependencies tag, like
After you save the pom.xml and run Maven –> Update Project or Alt + F5, Maven will get all the required files. In my case it result in 2 jar files. The Databind and the Core.
Conclusion
Maven makes your live as a developer easy, because it will handle all the dependencies of your plugins. This is only one powerful feature of Maven.
I will write more blog posts to highlights other powerful features of Maven, like create or build projects