Maven tips and tricks

November 5, 2009

Here’s a couple of maven commands that are handing when it comes to debugging build problems.

If you want to see what deps Maven is pulling in (or hand tweak them), then you can use.

mvn dependency:tree -Dverbose

I usually pipe that to less, however, be aware that maven will print out all deps regardless of whether they are going to get used or not. You will need to look at the end of the output which shows the resolved versions that will be used.

If the issue is one of a class not getting loaded correctly, then you can try this

mvn dependency:copy-dependencies  -DoutputDirectory=...

then you can add them to your classpath manually and run the application, tweaking as needed to get your intended class to load.

The following will load a custom config for your maven build (so you can test out tweaks to your config)

mvn -s ./profile.xml compile


Follow

Get every new post delivered to your Inbox.