Building complete application folder with maven

前端 未结 1 2021
清酒与你
清酒与你 2021-01-06 10:53

mostly all java standalone-applications end up in a folder looking like this after they are deployed to production.

myapp  
|->lib (here lay all dependenc         


        
1条回答
  •  轮回少年
    2021-01-06 11:20

    This kind of deployment directory structure is very popular and have adopted by many brilliant apps like apache maven and ant.

    Yes, we can achieve this by using maven-assembly-plugin at maven package phase.

    Sample pom.xml:

      
      
        org.apache.maven.plugins
        maven-assembly-plugin
        2.2-beta-5
        
          
            package
            attached
          
        
        
          
            src/main/assembly/binary-deployment.xml
          
        
      
    

    Sample binary-deployment.xml:

    
    
      bin
      
        tar.gz
      
      true
      
        
          src/main/java
          conf
          
            *.xml
            *.properties
          
        
        
          src/main/bin
          
          true
          755
        
        
          src/main/doc
          doc
          true
        
      
      
        
          lib
          true
          false
          runtime
        
      
    
    

    0 讨论(0)
提交回复
热议问题