thomas11

2008-03-04

Useful Maven commands

Filed under: tech — Tags: , , , — thomas11 @ 17:36

On the current project, we use Maven.  It wasn’t really my choice, I just went along with the Wicket and databinder world where it’s commonly used.  I could get into a rant about the annoying experiences we had with it, but that has been done elsewhere more eloquently than I could put it.  And anyway, let’s be fair: it has its great sides, too.  No more (almost) hunting for jars and manually adding them to the Eclipse build path rocks.  So let me instead just share a few often-used commands, because I find the documentation sorely lacking.

  • mvn source:jar – package (only) the source code into a jar file.
  • mvn install – compile, pack into jar, andcopy to the local maven repository.  Ok, that was straightforward.
  • mvn package – only the jar packaging.
  • mvn eclipse:eclipse – create an Eclipse project for the current project.  Very handy, as it sets the build path.
  • -DdownloadSources=true – a parameter you can add to any command, and probably should: download the sources for every downloaded jar.  Makes debugging and looking up sources from Eclipse a snap.

1 Comment

  1. I have compiled a mini guide command reference for maven, You can see it here http://www.shankh.com/2009/07/12/maven-commands-reference-mini-guide/

    Comment by don — 2009-07-14 @ 21:25


RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Create a free website or blog at WordPress.com.

%d bloggers like this: