calum.org:~#

Why did no-one tell me about... Maven?!

Tags: java programming maven

Added: 2011-11-18T21:04:42

Why did no-one tell me about... Maven?!

If you're like me, and you've been struggling with Java build systems, such as NetBean's inbuilt one, or Ant, let me tell you - check out Maven.

Everyone's been using it for ever, so it's properly tested, and widely supported.
You add libraries by defining dependencies in Maven, and it takes care of going and getting them.

All you have to do to start using it, is shovel your code around to fit this directory structure:

src/main/java
src/test/java
src/main/webapp
Grab a copy of Maven (go with 2.2 for now), and stick this starter pom.xml in the directory too:
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-module</artifactId>
  <version>1</version>
</project>
then run:
mvn test install
and it should spit something out into the target directory.

OK, it's not *quite* that easy. However, you will just need to add the dependencies as more XML in your pom.xml file. Say that last command complains that
package org.apache.commons.lang does not exist
Simply Google for: maven org.apache.commons.lang, and it will direct you to a page on mvnrepository.com which has the relevant XML excerpt to add to your pom.xml.

Anyway, use it.

posted by Calum on 2011-11-18T21:00 under

Add a comment

Your IP:
Please enter 3405628 here: