When to use maven dependency management and dependencies

When to use dependency management and dependencies in a maven project. We decompose the existing project into 6 independent modules. it

Project-core
project-DAO
project-messages
project-services
project-testing
project-web

we plan to provide parents with all of the above projects and place common dependencies there. But we do not know where to use <dependencyManagement>and <dependencies>. Please provide valuable suggestions.

Thanks
Anil Kumar C

+3
source share
1 answer

Based on your ideas, I would suggest the following folder structure:

+-- ProjectParent
      +-- Project-core
      +-- project-DAO
      +-- project-messages
      +-- project-services
      +-- project-testing
      +-- project-web 

which lead to the presence of a parent (ProjectParent), which must contain a dependencyManagement section for defining dependencies with their respective versions as follows:

   <dependencyManagement>
     <dependencies>
       <dependency>
          <groupId>testng</groupId>
          <artifactId>testng</artifactId>
          <version>6.3.1</version>
          <scope>test</scope>
       </dependency>
       ...
     </dependencies>
   </dependencyManagement>

:

    com.company.project     -     1.0.0-SNAPSHOT  

 <dependencies>
   <dependency>
      <groupId>testng</groupId>
      <artifactId>testng</artifactId>
   </dependency>
   ..
 </dependencies>

.

, , .

+3

All Articles