Maven Global dependency exclusion

With Maven becoming the build tool of choice for Jave EE developers, one of the problems that a developer faces frequently is that of Transitive dependencies. Problems like ClassCastException and LinkageError  are encountered during deployment of an application because of the same class being loaded by different ClassLoaders  or presence of different versions of the same set of APIs as a result of transitive dependency.

Such issues become even more elusive to debug if the Application server your using comes bundled with a whole galaxy of commonly used jar files(yes i am talking ’bout JBoss :D).  Lets see couple of such cases.

Read more of this post


QuickTip: maven jetty plugin issue

The following issue is encountered most of the times in maven war projects when you type “mvn clean jetty:run” in the command line and hope to see your WAR project deployed on jetty but instead you get the dreaded error.

[INFO] ————————————————————————
[INFO] The plugin ‘org.apache.maven.plugins:maven-jetty-plugin’ does not exist or no valid version could be found
[INFO] ————————————————————————
[INFO] For more information, run Maven with the -e switch

The easiest way to fix this issue is to give complete info about the jetty plugin in the command line and deploy your WAR file i.e.
mvn org.mortbay.jetty:maven-jetty-plugin:run

The above command should fix your problem.