Friday, March 6, 2015

Ant, Ivy, Maven, Gradle, what and why?

Developers coming from the .Net world often wield several arguments against Java, some of these with reason, and others simply by sheer laziness.

One of the most common arguments against Java is the number of technologies and libraries around it, too many of them to do the same thing, and when you want to start, you find yourself lost in a ocean of information, often disorganized, almost in a chaos.

But, is it good or bad to have several libraries to achieve our goals?

The positive aspects of this situation from the perspective of the native Java developers are:

- The variety of options to achieve a single goal.
- It is almost always Open Source code, so, you can fix it if you need it.

The negative aspects of this situation from the perspective of native .Net developers?

- You don't know where to start.
- You don't know which, of the many technologies, is the best. Take for example this list of Views Templates: JSP/JSTL, Thymeleaf, Tiles, Freemarker, Velocity. It means that even within the same Java world it may be high learning curve to include a new member to the team.
- Little centralized documentation.
- The shelf life of the technologies is relatively much shorter than in .Net.
- And finally, there is a tree of dependencies between libraries with many levels, many times becoming an endless story.

Are the .Net people wrong? - No, I think they are not.

I clearly remember that years ago I was working on a project to make a website for games. The project leader (one of the people with more knowledge of the Java world) wanted to use quite an advanced and complex library set. A couple of years later I asked him to mount the site on a test server to show it to a client and you know what?

1- He needed a huge time to install everything from scratch. In the end, we never installed the app again.
2- The main library that we used, the core of everything, was not developed further. It would be forever forgotten. Besides, the huge list of dependencies had run with the same luck.

Then, in the midst of all this chaos, something or someone should put order and simplify these processes. That's where tools for project and dependency management, automatic updates, packaging and distribution, appear.

Here is why the native .Net developer finds so complex to come into the Java world, because in all honesty, they never have had that chaos: they have always had a MSDN containing all the documentation centralized, either online or offline.

Then, in the Java world arises Ant, Ivy, Maven, Gradle, etc., and one problem was solved, but at the same time this keeps the other problem open; which one of the many availables project's managers is good to me?

It's really ironic because something created to organize the chaos collaborates to create even more chaos, ha ha.

Well, the most famous and used tool is Maven, I think, but lately Gradle is raising with much power. However, Gradle has "partnership" with Maven because it makes use of its repositories and all his knowledge accumulated over the years.

Gradle is now used by Android Studio. Gradle is now on par with Maven in the Spring Framework tutorials.

There you go a list of useful resources: