The Dependency Conflict Cannot be Resolved

A project I work on is using both “”, a now inactively under development web framework, and “org.drools:drools-compiler” as its dependencies, both of which then depend on “org.mvel:mvel2”. Maven used to find a version of mvel2 to satisfy both of the two dependencies.

However, when the “drools-compiler” dependency is upgraded to a newest version (“7.13.0.Final”), something unfortunate happens. The “drools-compiler:7.13.0.Final” uses a mvel2 version, which is incompatible with the one sitebricks uses. The “drools-compiler” uses some new APIs from the newer version of mvel2, unfortunately, that version of mvel2 deletes some APIs “sitebricks” uses. In this case, Maven cannot resolve the dependency conflict easily since there is NO version of mvel2 to satisfy “drools-compiler:7.13.0.Final” and “sitebricks:*”.

A Fix

Use Maven Shade Plugin to package sitebricks and its mvel2 dependency into a “shaded jar”, and also use this plugin to “relocate” mvel2 classes inside the “shaded jar”. “Relocation” here is to move mvel2 classes from package “org.mvel2” to some other package like “org.shaded.mvel2”, and to also modify bytecode of some sitebricks classes, which refers mvel2 classes, correspondingly, so that these “mvel2 classes” do not conflict with those used by “drools-compiler”.

Create a Maven project/module for the “shaded jar”.


In the project, use the “sitebricks-shaded” as a dependency instead.


And one more step. Look at the sitebricks-shaded-VERSION.pom in the ~/.m2, you will find the shaded jar only has one dependency, “org.projectlombok:lombok”. That means by simply replacing “sitebricks” with “sitebricks-shaded” in the project, it loses all the dependencies introduced and needed by the “sitebricks”.

Therefore create another Maven project (module) called “sitebricks-pom”,


In its pom.xml, simply copy all dependenciy of the “sitebricks” (which can be found in the file ~/.m2/PATH_TO/sitebricks-X.Y.Z.pom) but leave out those already included in the shaded jar.

Add “sitebricks-pom” as a dependency to the project.

That’s a fix to finally solve the problem.