maven打包 Internal error in the mapping processor: java.lang.SecurityException: Invalid signature file

1. Problem description

mapstruct maven打包 Internal error in the mapping processor: java.lang.SecurityException: Invalid signature file

 Internal error in the mapping processor: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes      
 at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:330)          
 at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:263)      
 at java.util.jar.JarVerifier.processEntry(JarVerifier.java:318)      
 at java.util.jar.JarVerifier.update(JarVerifier.java:230)       
 at java.util.jar.JarFile.initializeVerifier(JarFile.java:383)   
 at java.util.jar.JarFile.getInputStream(JarFile.java:450)       
 at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:164)       
 at java.net.URL.openStream(URL.java:1045)       
 at java.util.ServiceLoader.parse(ServiceLoader.java:304)        
 at java.util.ServiceLoader.access$200(ServiceLoader.java:185)   
 at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:357)       
 at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:393)         
 at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474)   
 at org.mapstruct.ap.internal.util.AnnotationProcessorContext.initialize(AnnotationProcessorContext.java:132)         
 at org.mapstruct.ap.internal.util.AnnotationProcessorContext.getAccessorNaming(AnnotationProcessorContext.java:244)     
 at org.mapstruct.ap.internal.processor.DefaultModelElementProcessorContext.<init>(DefaultModelElementProcessorContext.java:53)       
 at org.mapstruct.ap.MappingProcessor.processMapperElements(MappingProcessor.java:264)   
 at org.mapstruct.ap.MappingProcessor.process(MappingProcessor.java:166)      
 at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)         
 at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)   
 at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)         
 at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)    
 at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)      
 at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)     
 at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)         
 at com.sun.tools.javac.main.Main.compile(Main.java:523)      
 at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)         
 at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)   
 at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)       
 at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:169)      
 at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:785)      
 at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)         
 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)    
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)   
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)      
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)      
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)          
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)      
 at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)     
 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)      
 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)      
 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)    
 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)         
 at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)     
 at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)      
 at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)     
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)          
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)        
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     
 at java.lang.reflect.Method.invoke(Method.java:498)     
 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)          
 at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)       
 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)        
 at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)

Two, the solution

I searched on the Internet, and they said nothing, because there is a redundant .SF file in the META-INF in the dependent jar package that conflicts with the current jar package. I am not at all, first confirm the problem, and locate it according to the typed log. The reason for mapstruct is that as long as you use @Mapper classes, you will report an error. Comment out all @Mapper first, and then mvn install will be fine. After working for a long time, I found out that other modules are the same as this one. Why is there no problem? There is a problem with this. I found the problem by looking at the jar with the @Mapper annotation removed. An executable jar was introduced into the module, that is, a module was packaged into an executable jar, and then it was dependent on the module, resulting in the module Also packaged into a viable jar package
insert image description here

Moreover, the size of the packaged jar is very small, and the dependent modules can be solved by canceling the plug-in packaged into an executable jar package and packaging it into a normal jar package.

Guess you like

Origin blog.csdn.net/mashangzhifu/article/details/122507206