Maven Anti Pattern

Recently i came across a strange application of Maven. In fact it seems so appalling and ridiculous, so i decided to share as anti pattern for Maven usage.

Consider the following

1. There is an old product which us being build with Ant.

2. Product is a platform and provides infrastructure for more add ons.

3. New software is being developed as a plugin, implementing an interface of the infrastructure.

4. New software is developed using Maven.

So at this point there is a question - how the platform should be passed to Maven repository so that new software would be able to create dependencies on that platform.


The solution for that problem was creative - Automated POM generation at while deploying a JAR to repository.

GREAT - all of problems are solved, no code to change or to add.


And now the winner - so the platform appears in Maven repository under some artifact, something like : platform:platform:1.0.

And new plugin for the platform will use this artiact id as a dependency.

And once you want to use some platform feature, which has dependency to some 3rd party software you will get a compile error.


Indded, after all that is what Maven is for. Each artifact should know its dependencies and versions of those dependencies.


It turns out that autogeneration of a POM does not know how to generate dependencies. As a result you get an artifact, without its dependencies.

In order to solve this problem, new plugin for the platform MUST add to plugin POM dependencies of the platform.


In my opinion this is a great example of how NOT to use Maven. Come on - its fairly easy to write a few POMs with dependencies, rather then doing crapy products.