How can I package a jar with Maven and include some dependencies in WEB-INF/lib?

后端 未结 1 1272
予麋鹿
予麋鹿 2020-12-09 22:29

How can I package a jar with Maven and include some dependencies in WEB-INF/lib?

I tried with assembly, but cannot be achieved easier?

1条回答
  •  伪装坚强ぢ
    2020-12-09 22:57

    Try using the jar-with-dependencies feature of the maven-assembly-plugin:

    
        maven-assembly-plugin
        2.2.1
        
            
                jar-with-dependencies
            
        
        
            
                make-assembly 
                package
                
                    single
                
            
        
    
    

    This will incorporate all dependencies into your jar. Mark the dependencies that you don't want included in your jar with provided, eg:

    
        net.sf.ehcache
        ehcache-core
        2.4.4
        provided
    
    

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