Bootstrap

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

记一次奇怪的问题,本地开发运行的时候不会报错,打包运行后就报这个错误

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

网上找了很多资料,需要打包的时候把引入的jar包里面包含META-INF/*.SFMETA-INF/*.DSAMETA-INF/*.RSA都过滤掉,在pom文件里面添加配置,mainClass换成自己的启动类就行

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                            <transformers>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>com.tq.SdkDownloadMain</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

悦读

道可道,非常道;名可名,非常名。 无名,天地之始,有名,万物之母。 故常无欲,以观其妙,常有欲,以观其徼。 此两者,同出而异名,同谓之玄,玄之又玄,众妙之门。

;