Maven Import Scope

Maven includes a dependency scope called "import".  This is meant to allow dependency management information such as versions and excludes be retrieved from a remote POM file.

http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

 

This page is meant to document the proper use and caveats of the import scope.

 

Combining Import Scope with Excludes

 

The import scope can be used to include dependency management information from a remote POM into the current project.  One of the limitations of this is that it does not allow additional excludes to be defined for a multi module project.  For example, I have a multi-module project which includes a single parent pom containing dependency management information and importing remote dependency management information.

 

parent  ---import---> project C

   ^

   |-----------|

project A   project B

 

Now project A and project B can use the dependency version information retrieved from project C.  Unfortunately, all excludes have to be defined in project C, when using the import scope, the parent project can no longer define dependency excludes for the dependencies imported from project C.  This means that project A and B have to duplicate the exclusion work for any dependencies coming from project C.