Is it possible to rename a maven jar-with-dependencies?

后端 未结 6 729
一整个雨季
一整个雨季 2021-01-29 19:47

I\'m currently using the jar-with-dependencies assembly to create such a jar. However, the name of my jar is a bit long.

Since this jar is being used by RPG programs

6条回答
  •  Happy的楠姐
    2021-01-29 20:36

    Thanks to the posts here and some digging in the maven docs I've come up with the following configuration for a general one-off repacked executable jar assembly with a custom name.

    In pom.xml:

    
        maven-assembly-plugin
        2.2
        
            
                exe
                package
                single
                
                    MyJarName
                    false
                    false
                    
                        assembly.xml
                    
                    
                        
                            karlthepagain.MyMain
                        
                    
                
            
        
    
    

    In assembly.xml:

    
        exe
        
            jar
        
        false
        
            
                /
                true
                runtime
            
        
    
    

    This will produce MyJarName.jar with all of its dependencies re-packaged into that same jar and the specified Main-Class: karlthepagain.MyMain.

提交回复
热议问题