栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

springboot maven-assembly-plugin使用

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

springboot maven-assembly-plugin使用


springboot maven-assembly-plugin使用

                                  

官网:Apache Maven Assembly Plugin – Introduction

                                                  

                                           

**********************

maven assembly plugin

                         

The Assembly Plugin for Maven enables developers to combine project output into a single 
distributable archive that also contains dependencies, modules, site documentation, and 
other files.
# assembly插件可将project output、dependencies、模块、site文档等文件整合为一个文档

                 

支持的文档格式

Currently it can create distributions in the following formats:
zip、tar、jar、dir、war
tar.gz (or tgz)
tar.bz2 (or tbz2)
tar.snappy
tar.xz (or txz)
and any other format that the ArchiveManager has been configured for

                       

assembly descriptor format:描述归档文件的项目结构

                            
                       
          
                 
          

  
  
    
      
      
    
  

  
  
                
      
      
      
      
                  
        
        
        
        
        
        
        
          
            
            
            
            
                                 
                            
            
            
            
            
          
        
        
        
        
      
                    
        
        
        
        
        
        
        
        
          
            
            
            
            
            
            
            
            
            
              
              
              
              
              
              
              
            
            
            
            
            
            
          
        
        
               
          
          
          
          
          
          
          
        
        
      
    
  

  
  
                
      
      
      
      
      
      
      
      
      
      
    
  

  
  
      
           
      
      
      
      
      
      
    
  

  
  
      
      
      
      
      
      
      
      
      
      
        
        
        
        
        
        
        
      
      
      
      
      
      
    
  

  
  
          
      
      
      
      
      
      
      
        
          
          
          
        
      
      
    
  

  
  

                          

                                   

**********************

示例

                    

配置文件、依赖jar包外置,将配置文件、依赖jar包、项目jar包归档压缩

                        

                        

                         

assembly.xml

    assembly
    
        tar.gz
        zip
    

    
        
            ${project.build.directory}/config
            config
        

        
            ${project.build.directory}/lib
            lib
        

        
            ${project.build.directory}
            .
            
                ${project.build.finalName}.jar
            
        
    

                       

pom.xml



    4.0.0
    
        org.springframework.boot
        spring-boot-starter-parent
        2.5.5
         
    
    com.example
    demo
    0.0.1-SNAPSHOT
    demo
    Demo project for Spring Boot
    
        11
    
    
        
            org.springframework.boot
            spring-boot-starter-web
        

        
            org.springframework.boot
            spring-boot-configuration-processor
            true
        
        
            org.projectlombok
            lombok
            true
        

        
            org.apache.maven.plugins
            maven-assembly-plugin
            3.3.0
        

        
            org.springframework.boot
            spring-boot-starter-test
            test
        
    

    
        hello
        
            
            
                org.springframework.boot
                spring-boot-maven-plugin
                
                    
                        
                            org.projectlombok
                            lombok
                        
                    
                    
                        
                            nothing
                            nothing
                        
                    
                
            

            
            
                org.apache.maven.plugins
                maven-jar-plugin
                3.2.0
                
                    
                        
                            true
                            lib
                        
                    
                
            

            
                org.apache.maven.plugins
                maven-dependency-plugin
                3.2.0
                
                    
                        copy
                        package
                        
                            copy-dependencies
                        
                        
                            jar
                            jar
                            ${project.build.directory}/lib
                        
                    
                
            

           
           
                org.apache.maven.plugins
                maven-assembly-plugin
                3.3.0
                
                    
                        src/main/resources/assembly/assembly.xml
                    
                
                
                    
                        assembly
                        package
                        
                            single
                        
                    
                
            
        

        
        
            
                ${build.directory}/config
                src/main/resources
                
                    *.properties
                    *.yml
                
            
        
    


                         

项目打包

                        

                     

解压hello-assembly.tar.gz:配置文件、依赖jar包、项目jar包都已打包 

                        

                                               

                                 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/285393.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号