Creating a zip archive of the maven “target” directory

后端 未结 2 1810
北恋
北恋 2020-12-05 06:25

I wish to create a zip archive of my \"target\" directory (${project.build.directory). using the maven-assembly-plugin seems to me like overkill for such a simple task (and

2条回答
  •  自闭症患者
    2020-12-05 07:22

    If the bin predefined assembly descriptor doesn't suit your needs, then you have three options:

    1. Using the maven-assembly-plugin - The maven-zip-plugin never came out because the assembly plugin can do everything the zip plugin was doing, and more, see MNG-2243.
    2. Using the maven-antrun-plugin (and maybe the build-helper-plugin to attach the zip) - There is an example here (and this looks more verbose than the assembly plugin at the end).
    3. Writing your own plugin - why would you do this when you have the assembly plugin.

    Personally, I would just use the maven-assembly-plugin with the following zip.xml descriptor:

    
      bin
      /
      
        zip
      
      
        
          ${project.build.directory}
        
      
    
    

    And in your POM:

    
      maven-assembly-plugin
      2.6
      
        
          src/main/assembly/zip.xml
        
      
      
        
          make-assembly 
          package 
          
            single 
          
        
      
    
    

提交回复
热议问题