Intellij鎵撳寘jar鏂囦欢锛屸€渏ava.lang.SecurityException: Invalid signature file digest for Manifest main att

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Intellij鎵撳寘jar鏂囦欢锛屸€渏ava.lang.SecurityException: Invalid signature file digest for Manifest main att相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/ips' title='ips'>ips   鍒犳帀   toolbar   鍛藉悕绌洪棿   鐩存帴   缁撴灉   title   鏃犳硶鎵惧埌   bar   

寮€濮嬩娇鐢ㄥ涓嬩唬鐮佽繘琛屾墦鍖?/p>

鎶€鏈浘鐗? src=
鎶€鏈浘鐗? src=
<build>
        <!-- mvn assembly:assembly -Dmaven.test.skip=true -->
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2-beta-5</version>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>com.fxc.rpc.impl.member.MemberProvider</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>assembly</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
鎶€鏈浘鐗? src=
鎶€鏈浘鐗? src=

 缁撴灉鍑虹幇spring鍛藉悕绌洪棿鏃犳硶鎵惧埌鐨勯敊璇紝

org.xml.sax.SAXParseException: schema_reference.4: 鏃犳硶璇诲彇鏂规鏂囨。 鈥榟ttp://www.springframework.org/schema/beans/spring-beans.xsd鈥? 鍘熷洜涓?1) 鏃犳硶鎵惧埌鏂囨。; 2) 鏃犳硶璇诲彇鏂囨。; 3) 鏂囨。鐨勬牴鍏冪礌涓嶆槸 <xsd:schema>銆?/pre>

鎹煡鏄敱浜巗pring-core锛宻pring-aop姣忎竴涓猨ar涓兘鍖呭惈浜嗕竴濂梥pring.handlers锛宻pring.schemas鏂囦欢锛屼互鑷充簬鍦ㄦ墦鍖呰繃绋嬩腑鍙戠敓浜嗚鐩栵紝缃戜笂娌℃湁鎼滃埌浣跨敤maven-assembly-plugin鎻掍欢濡備綍瑙e喅姝ら棶棰橈紝澶у鏁颁汉寤鸿浣跨敤maven-shade-plugin鎻掍欢锛屼慨鏀瑰悗pom浠g爜濡備笅

鎶€鏈浘鐗? src=
鎶€鏈浘鐗? src=
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>1.4</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <transformers>
                    <transformer
                        implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                        <resource>META-INF/spring.handlers</resource>
                    </transformer>
                    <transformer
                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <mainClass>com.fxc.rpc.impl.member.MemberProvider</mainClass>
                    </transformer>
                    <transformer
                        implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                        <resource>META-INF/spring.schemas</resource>
                    </transformer>
                </transformers>
            </configuration>
        </execution>
    </executions>
</plugin> 
鎶€鏈浘鐗? src=
鎶€鏈浘鐗? src=

鍐嶆鎵撳寘锛屽嚭鐜版枃浠剁鍚嶄笉鍚堟硶鐨勯棶棰?/p>

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

鍐嶆煡锛屽師鏉ユ槸鐢变簬鏌愪簺鍖呯殑閲嶅寮曠敤锛屼互鑷充簬鎵撳寘涔嬪悗鐨凪ETA-INF鐨勭洰褰曚笅澶氬嚭浜嗕竴浜?.SF,*.DSA,*.RSA鏂囦欢鎵€鑷达紙鎹瑙e帇jar鍖咃紝鐒跺悗鍒犳帀杩欎簺鏂囦欢鍐嶆鎵撳寘閿欒灏变細娑堝け锛屾湭纭锛夛紝鍐嶆淇敼pom.xml锛屾渶缁堜娇鐢ㄥ涓嬮厤缃枃浠讹紝杩愯

mvn clean install -Dmaven.test.skip=true

鎵撳寘鎴愬姛

鎶€鏈浘鐗? src=
鎶€鏈浘鐗? src=
<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>1.4</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.AppendingTransformer">
                                <resource>META-INF/spring.handlers</resource>
                            </transformer>
                            <transformer
                                implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>com.fxc.rpc.impl.member.MemberProvider</mainClass>
                            </transformer>
                            <transformer
                                implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                <resource>META-INF/spring.schemas</resource>
                            </transformer>
                        </transformers>
                    </configuration>
                </execution>
            </executions>
        </plugin>
鎶€鏈浘鐗? src=
鎶€鏈浘鐗? src=

姝ゆ椂鏌ョ湅target鐩綍涓嬩細鍙戠幇xxx.jar 鍜宱riginal-xxx.jar锛屽悗涓€涓笉鍖呭惈寮曠敤鐨刯ar鍖咃紝鐩存帴杩愯鍓嶄竴涓嵆鍙?/p>

java -jar target/xxx.jar 

鎴愬姛锛?/p>

PS锛氶」鐩腑浣跨敤浜嗗嚑涓叕鍙歌嚜宸辩殑jar锛屽湪鍏湁搴撻噷娌℃湁锛屽湪eclipse閲岃繍琛岀殑鏃跺€欐垜閮芥槸淇敼scope涓簊ystem锛岃皟鐢ㄧ殑鏈湴jar锛屼絾鏄湪鎵撳寘鐨勮繃绋嬩腑scope=system鐨刯ar鏄笉浼氳嚜宸辨墦杩涘幓鐨勶紝寰堟槸璁╂垜閮侀椃锛屾垜鍙ソ璁茶繖浜沯ar瀹夎杩涘叆鏈湴璧勬簮搴?/p>

mvn install:install-file -Dfile=my-jar.jar -DgroupId=org.richard -DartifactId=my-jar -Dversion=1.0 -Dpackaging=jar

 

以上是关于Intellij鎵撳寘jar鏂囦欢锛屸€渏ava.lang.SecurityException: Invalid signature file digest for Manifest main att的主要内容,如果未能解决你的问题,请参考以下文章

灞傚眰浼樺寲webpack鎵撳寘浣撶Н

馃檲 濡備綍闅愯棌浣犵殑鐑洿鏂?bundle 鏂囦欢锛?/a>

Linux鍛戒护 find鍜宮v鐨勭粨鍚堜娇鐢細鏌ユ壘鏂囦欢锛岀Щ鍔ㄥ埌鏌愪釜鐩綍

濡備綍鍦ㄤ娇鐢╒ue鐨勬儏鍐典笅瀹炵幇Electron鎵撳紑鏂囦欢淇濆瓨瀵硅瘽妗嗭紵

linux瀹氭椂浠诲姟鎵цphp鑴氭湰鍒犻櫎鏂囦欢

.jar鏂囦欢鎵ц鍛戒护