Skip to main content

Posts

Showing posts from April, 2009

Reason 3: Don't build everything all the time

This post is a part of a tiny series I'm doing on why we use Maven, and you should too.

Previous posts:
Introduction: Why you should use MavenReason 1: Get your libs-folder out of SVNReason 2: Clean up your JAR-filesHuge projects are hard to work with
Many projects that have grown over time will become too large to easily work with. The workspace gets too many classes, the IDE slows down and the build takes too long. If the developers focus on separating the concerns of the classes into packages of functionality, these packages can be organized into modules. As the contract and concern of a module becomes more defined, its rate of change will fall to a lower frequency than the rest of the project.

Once a module's activity has slowed down sufficiently, you can retire it into an external project, build a JAR-file from it and use this ready-built artifact as a classpath element for building and running the software instead. If changes occur later on, you can re-build the JAR-file.

Exa…

Reason 2: Clean up your JAR-files

Update: Added a summary section at the end of this post.

This post is a part of a tiny series I'm doing on why we use Maven, and you should too.
Previous posts:
Introduction: Why you should use MavenReason 1: Get your libs-folder out of SVNSome background

Back a couple of months, I got the rewarding task of cleaning up our project's lib folder. You know the one: Crammed with JAR-files of various versions of the various dependencies your project has..
fizz-project \ fizz-core fizz-web fizz-libs \ junit.jar spring.jar common.jar lots and lots of others... ...
Yup, good old fizz-libs. It needs to be regularly cleaned up to reduce software rot. Over time, the developers try out new open source libraries and remove the use of old ones, but they seldom take care to clean out the libs-folder, because they don't know if there could be any hidden effects from removing JAR files.

Now, at our place we use Eclipse's .classpath file for specifying each module's depe…

Reason 1: Get your libs-folder out of SVN

This post is a part of a tiny series I'm doing on why we use Maven, and you should too.

Previous posts:
Introduction: Why you should use Maven
The libs folder

We have a libs-module in Subversion. When you check out the source code for our main product, this is one of the modules you get. It contains a hundred-and-some JAR-files. These are the dependencies for the sum of our modules:

fizz-project
\
fizz-core
fizz-web
fizz-libs
\
junit.jar
spring.jar
common.jar
Downloading all these MB's of JAR files is something you'll have to do no matter which build system you use, so bandwith cost isn't an argument. Subversion also uses binary diffs, so copying or changing a JAR file doesn't increase repository size significantly.

The problem arises when you want more than one product. As soon as you want to split your product into two applications (or services), each project needs its own libs-folder:

fizz-project
\
fizz-core
fizz-web
fizz-libs
\
junit.jar
spring.j…

Why you should use Maven

Update: I'm doing some work to split this blog post into some more fine grained posts in a series. Please, bear with me if these changes are giving you lots of noise in your feed-reader.

I used to work as a consultant. My job was to improve our clients' ways of software development. Among the most important things I tried to teach them were:

o Good code style and object orientation
o Practical use of good open source tools (don't re-invent the wheel)
o Automating tests of their software, and continuous integration
o Splitting code into modules, dependency-relationships and versions

The last point is perhaps the trickiest. It's hard to understand why it's needed in an isolated project, it is hard to explain how it should be done, and most importantly, there is no de-facto way or standard for managing modules, their relationships, versions and scope.

This is why me and my consultant buddies embraced Maven many years ago. After years of pushing and evangelizing at our…