Hidden gems: maven help and eclipse plugin

When working with maven multi module builds over several levels, where properties, dependencies and plugin configurations are stored in multiple parent poms, it is sometimes useful to actually see the resulting or effective pom.

The maven help plugin offers a simple way of displaying the effective pom of a multi module build.

To display the effective pom for a maven project simply run:

The output might be very lengthy since this command includes the settings as well. Nevertheless: this can be helpful for debugging build problems.

If you do not need the whole effective pom but you only want to see the result of a single maven expression, the evaluate goal might be interesting:

In this example the property “myproperty” which is part of the pom will be evaluated. The output looks something like this:

Another useful plugin is the maven eclipse plugin. Especially if you are setting up a new maven project, it might be useful to directly create the eclipse .project and .classpath files. This can be done by running the following command:

Note that this command will only produce output when the “packaging” is set to “jar”.

Also very interesting is the to-maven goal that adds eclipse artifacts from an eclipse installation to the local repo. Thus effectively migrating an eclipse project to maven.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">