Maven build second level+ child projects using reactor option -pl

前端 未结 3 1372
半阙折子戏
半阙折子戏 2021-02-05 08:10

My maven project structure is as below

Project A 
  pom.xml
  - ProjectB
    pom.xml
    - ProjectC
      pom.xml
    - ProjectD
      pom.xml
  - ProjectY
    p         


        
3条回答
  •  醉话见心
    2021-02-05 08:59

    From the documentation for the -pl option it states the following:

    -pl,--projects                 Comma-delimited list of specified
                                        reactor projects to build instead
                                        of all projects. A project can be
                                        specified by [groupId]:artifactId
                                        or by its relative path.
    

    The important part for you is: "or by its relative path".

    So to build projectC, you simply need to refer to it by its relative path (projectB/projectC). So the command you need is:

    mvn clean install -pl projectB/projectC
    

提交回复
热议问题