Having a maven project build its own dependencies?

前端 未结 7 2218
故里飘歌
故里飘歌 2021-02-13 03:40

With maven is it possible to have a top-level project who\'s packaging type is \"war\" which will build itself and all of its dependent modules (packaged as jar) and have the bu

7条回答
  •  太阳男子
    2021-02-13 04:43

    super_aardvark suggested correct way but,
    For requirement I would suggest following structure It is suitable and good structure also :

    Consedering ProjectA as project-webapp , ProjectB as project-core

    You can have following structure :

    Your Grand Project :

    
    
    
        4.0.0
    
        com.mycompany.project
        project
        2.0-SNAPSHOT
        pom
    
        Project Repository System
        Project Repository System R2
    
        
            project-core
            project-webapp
        
     
    

    Your WebApp Project:

    
    
        
            com.mycompany.project
            project
            2.0-SNAPSHOT
        
        4.0.0
        project-webapp
        2.0-SNAPSHOT
        war
        Project Web Application
        Project Repository
        
                com.mycompany.project
                project-core
                2.0-SNAPSHOT
         
    
     
    

    Your Core Project:

    
        
            com.mycompany.project
            project
            2.0-SNAPSHOT
        
        4.0.0
        project-core
        2.0-SNAPSHOT
        jar
        Project Core
        ProjectCore
    
     
    

    Your Directory structure should look like:

    -------Grand Parent.pom
      |
      |--------project-webapp
      |                     |
      |                     project-webapp.pom
      | 
      | -------project-core.pom
                            |
                           project-core.pom
    

    From parent pom execute mvn clean install it will build both the web-app and core project

提交回复
热议问题