Maven - how to include empty directories

后端 未结 5 1290
灰色年华
灰色年华 2020-11-30 07:25

By default during the build process maven is removing the empty directories.
Do you know if a parameter can be specified in the pom to instruct maven to include empty di

5条回答
  •  死守一世寂寞
    2020-11-30 07:51

    According to this ticket MRESOURCES-36, there should be a element, but only for Maven Resources Plugin 2.3.

    
      org.apache.maven.plugins
      maven-resources-plugin
      2.3
      
        true
      
    
    

    For Maven versions which included an older version of the Resources plugin:

    Until this issue is fixed, here is a workaround I've been using successfully.
    Add this plugin element into project/build/plugins in your pom.xml, and change the dir in the mkdir task.

    You can have multiple elements for multiple directories. The mkdir task does nothing if the directory has already been copied by the resources plugin.

    
      org.apache.maven.plugins
      maven-antrun-plugin
      
        
          create-empty-directory
          process-classes
          
            run
          
          
            
              
            
          
        
      
    
    

    This originally came from the openejb-standalone pom.xml in the openejb project.

提交回复
热议问题