Building a fat jar using maven

后端 未结 6 1959
梦毁少年i
梦毁少年i 2020-11-21 23:51

I have a code base which I want to distribute as jar. It also have dependency on external jars, which I want to bundle in the final jar.

I heard that this can be do

6条回答
  •  一整个雨季
    2020-11-22 00:28

    Maybe you want maven-shade-plugin, bundle dependencies, minimize unused code and hide external dependencies to avoid conflicts.

    
        
            
                org.apache.maven.plugins
                maven-shade-plugin
                3.1.1
                
                    
                        package
                        
                            shade
                        
                        
                            true
                            true
                            
                                ${java.io.tmpdir}/dependency-reduced-pom.xml
                            
                            
                                
                                    com.acme.coyote
                                    hidden.coyote
                                
                            
                        
                    
                
            
        
    
    

    References:

    • http://maven.apache.org/plugins/maven-shade-plugin/plugin-info.html
    • http://maven.apache.org/plugins/maven-shade-plugin/shade-mojo.html

提交回复
热议问题