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.

Create a free website or blog at