Blog 2017 06 20 Horror with Maven - dependency management vs dependencies

Horror with Maven - dependency management vs dependencies

In fact we want to upload our code to a local OpenShift instance with the help of Fabric8 plugin. Maybe there is an IntelliJ plugin, but I did not go into that direction.

The first time I ran mvn install, everything went fine. Compilation succesful, packaging as well, I could deploy my server on Openshift in a minute. Great. There I had some problems though, my server didn’t start up.

I changed some settings in the pom.xml to remove some unsupported dependencies and run mvn again. Nothing. I mean nothing but failure. It couldn’t fine some dependencies. I did not change anything regarding those and it used to work…

Hm… I was checking my maven home, checking if the packages are available in our company repository, but I found no clues. Everything seemed fine. Another guy who says he has some experience with maven checked my pom.xml, but couldn’t find anything.

I tried to generate pom.xml by maven, but surprisingly it didn’t fix anything.

Long story short, I found that my dependencies were only declared in the <dependencyManagement> section which is useful if you have child projects which inherit dependencies and their versions. But it is for version control, you still have to declare your dependencies in the pom.xml, otherwise it’s not going to work. I only had the dependencies listed in the <dependencyManagement> section. After I listed them only in <dependencies>, it started to work.

Good that I learnt something.

This post is licensed under CC BY 4.0 by the author.