Finding the root directory of a multi module maven reactor project

前端 未结 13 1550
庸人自扰
庸人自扰 2020-12-02 11:11

I want to use the maven-dependency-plugin to copy artifacts from all sub-modules of my multi-module project to a directory that is relative to the root directory of the enti

13条回答
  •  無奈伤痛
    2020-12-02 11:30

    There is a maven plugin that solves this particular problem: directory-maven-plugin

    It will assign the root path of your project to a property of your choosing. See highest-basedir goal in the docs.

    For example:

    
    
      org.commonjava.maven.plugins
      directory-maven-plugin
      0.1
      
        
          directories
          
            highest-basedir
          
          initialize
          
            main.basedir
          
        
      
    
    

    Then use ${main.basedir} anywhere in your parent / child pom.xml.

提交回复
热议问题