Showing posts with label project. Show all posts
Showing posts with label project. Show all posts

Tuesday, January 10, 2017

Tutorial : Converting a java project to Maven project


Why Maven : You would find lot of articles on usage and power of Maven but in my experience biggest advantage is that you do not have to include/maintain those huge jar files in your code repository server. Very often real code or core of project runs into few mb's but if you include all the dependencies the size can become extremely bloated. With Maven in place developers (and consumers) can happily do quick rebase/clone commands, leaving the time consuming job of including dependencies to Maven. Best still if you have downloaded jars for other project, you do not have to download them again, and maven plugins in IDE (like Eclipse) handles the class paths transparently enough for you.

         


Imagine a scenario where you started off developing a java project and now would want to share it with developers/customers/testers etc. by leveraging Maven.There were a lot of hardships in converting your existing java projects into Maven earlier, but IDE plugins have have made developers life easier these days.

                                   


If you are using new releases of Eclipse, you already have a plugin installed m2e, if not you can download it from here : M2E Plugin

Steps to Convert

1. Right click on your existing project in eclipse and choose Configure -> Convert to Maven Project


                



2. Now you can open newly generated pom file in your project and add dependencies, and you can remove references from build path if you had added them manually.

3. If you want to get details on dependencies on jar files, try searching them on maven central. Once you click on the listed jar, you can get information like groupid, artifactid and version you want to use.


4. Once you have added all dependencies, right click on project and choose run as Maven clean, this should trigger download of all dependencies in your maven home directory. This also automatically adds dependencies to referenced libraries of your project, so you do not have to do it manually.

Merging and Splitting PDF files

We all use and rely on PDF's. There are occasions though when you want to edit certain portions of a pdf and merge the edited version ba...