Only create executable jar-with-dependencies in Maven

前端 未结 6 1231
悲&欢浪女
悲&欢浪女 2020-12-05 13:21

In my pom.xml I use the maven-assembly-plugin to create an executable jar-with-dependencies when running \"mvn clean install\". Now it first creates the non-exe

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-05 13:55

    I got it to work using the maven-jar-plugin and the single goal of maven-assembly-plugin like this

    
        org.apache.maven.plugins
        maven-assembly-plugin
        3.1.0
        
            
                package
                
                    single
                
                
                    finalName
                    
                        
                            
                                mainClass
                            
                        
                    
                    
                        jar-with-dependencies
                    
                
            
        
    
    

    Anyway the most important thing is to tell maven not to generate the default jar using this configuration of the maven-jar-plugin

    
        maven-jar-plugin
        3.0.2
        
            
                default-jar
                none
            
        
    
    

提交回复
热议问题