Exception in thread “main” java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

前端 未结 6 1919
忘掉有多难
忘掉有多难 2020-12-17 16:17
Exception in thread \"main\" java.lang.SecurityException: Invalid signature file d                    igest for Manifest main attributes
        at sun.security.util         


        
6条回答
  •  难免孤独
    2020-12-17 16:57

    This error means that maven shade plugin has modified one of your dependencies hence the signature for those libraries are invalid.

    remove the signature files is a work around and a solution depending on your use case. For me it is a bad practice so I ended up replacing the maven shade plugin for Apache Maven Assembly Plugin to create the jar with the dependencies and seems to work https://maven.apache.org/plugins/maven-assembly-plugin/

    example:

            
                org.apache.maven.plugins
                maven-assembly-plugin
                
                    
                        package
                        
                            single
                        
                        
                            
                                
                                    
                                        your.class.with.main.method
                                    
                                
                            
                            
                                jar-with-dependencies
                            
                        
                    
                
            
    

    build your jar with dependencies included:

    mvn package
    

提交回复
热议问题