Maven: Using defaultGoal to simplify creating feature branches

The manual execution of tasks like creating a git branch, setting the pom-versions, committing the changed pom.xml to setup a feature-branch can be automated.

See my example project at


Maven: Force the build to fail on a PMD violation 


The most important part is the binding of the plugin to a Maven phase. 

NBP: How to brand a Maven-based NB platform application using resource-filtering

Based on a discussion in the mailing list the following FAQ entry has been created.
It explains how use the maven-resource-plugin to replace content in the bundles. The example there shows you how to set the title of your NB platform application based on the version in the pom.xml. 

Quicktip: How to customize the names of Maven project nodes

Since NetBeans 7.4 you can configure the name of Maven-based project via options at “Tools|Options|Java|Maven|Appearance”. No additional plugin is required.


For other useful features have a look at the “New and Noteworthy” pages at

Quicktip: Maven-based NBM development and the user-dir

When you develop a NetBeans module using the Maven-approach, every time you “Clean & build” your module the userdir, which is placed in the target-directory by default, will be deleted. “Clean & Build” is necessary if you’re altering the layer.xml directly or indirectly by using annotations like @ActionReferences.  So after that you have to reconfigure your target platform again, f.e. by opening the same projects and files to restore the previous state. That is annoying, but easy to fix.

Add a profile to your settings.xml



After that you can choose the profile from the profile-dropdown or in the context-menu of the project node.


This way the configured userdir is used for running/debugging your NetBeans module. It won’t get deleted automatically.

Advanced tips: Of course you can also configure an absolute path or even make the profile default by applying activeByDefault



Maven: Force the exclusion of dependencies

In large Maven-based projects consisting of several high-level frameworks sooner or later there will come the time, when there are two versions of the same dependency in the classpath. For example: two versions of the same logging framework.

One approach to solve such ambiguity is to choose one of the versions (which is hopefully compatible) and to use it as an explicit dependency. Nevertheless other dependencies may still introduce other version as transitive dependencies. This may be caused by different groupIds, which will result in two similar named jar.

Once you got a candidate you can start finding all the possible sources of the dependency.

mvn dependency:tree -Dverbose -Dincludes=log4j:log4j

will show you the dependency-tree, but only the relevant excerpt. Using this information you can now add your exclusions to the affected pom.xml files.
Exclusions are configured via the exclusion-tag [1], which excludes specific transitive dependencies. For example:


By the way: Java IDEs can help you doing this.

After that you can make sure the faulty dependency versions will never ever be included again. This can be done using the maven-enforcer-plugin [2]

									<!-- exclude all versions lower than 1.2.17-->