Anthony Richir
Anthony Richir

Reputation: 649

Prevent usage of unmanaged dependencies in modules of maven project

For my project, I would like to prevent in maven modules the usage of dependencies that would not be declared in the dependencyManagement in the parent pom, is there a way to achieve this ?

Thanks

Upvotes: 1

Views: 120

Answers (1)

LePirlouit
LePirlouit

Reputation: 501

First, you will never be able to completely block the user to add dependency. User can still add the jar manualy in his code. Secondly yo can also decompres a module jar and put it in your project. (actually the same as with a ant build)

It's a good start to maintain a central place with all the version of your dependencies. In a kind of "corporate parent pom".

If your company have a nexus/artifactory, you can "close the door" at that point.

I think that's utopic to have the same version of your dependencies for all your applications. You always want to be able to use the latest feature of the latest version of the dependency.

Upvotes: 1

Related Questions