java - maven 打包依赖重复 求大佬
问题描述
报错信息:
Error: A JNI error has occurred, please check your installation and try againException in thread 'main' java.lang.SecurityException: Invalid signature file digest for Manifest main attributes at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:314) at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:268) at java.util.jar.JarVerifier.processEntry(JarVerifier.java:316) at java.util.jar.JarVerifier.update(JarVerifier.java:228) at java.util.jar.JarFile.initializeVerifier(JarFile.java:383) at java.util.jar.JarFile.getInputStream(JarFile.java:450) at sun.misc.JarIndex.getJarIndex(JarIndex.java:137) at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:839) at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:831) at java.security.AccessController.doPrivileged(Native Method) at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:830) at sun.misc.URLClassPath$JarLoader.<init>(URLClassPath.java:803) at sun.misc.URLClassPath$3.run(URLClassPath.java:530) at sun.misc.URLClassPath$3.run(URLClassPath.java:520) at java.security.AccessController.doPrivileged(Native Method) at sun.misc.URLClassPath.getLoader(URLClassPath.java:519) at sun.misc.URLClassPath.getLoader(URLClassPath.java:492) at sun.misc.URLClassPath.getNextLoader(URLClassPath.java:457) at sun.misc.URLClassPath.getResource(URLClassPath.java:211) at java.net.URLClassLoader$1.run(URLClassLoader.java:365) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
facade_app.jar pom.xml:
<project xmlns='http://maven.apache.org/POM/4.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd'> <parent><artifactId>iot_cloud</artifactId><groupId>com.iot.nero</groupId><version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>facade_app</artifactId> <packaging>jar</packaging> <name>facade_app</name> <url>http://maven.apache.org</url> <properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies><dependency> <groupId>com.iot.nero</groupId> <artifactId>parent_app</artifactId> <version>1.0-SNAPSHOT</version></dependency><dependency> <groupId>com.iot.nero</groupId> <artifactId>common</artifactId> <version>1.0-SNAPSHOT</version></dependency><dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version></dependency> </dependencies> <build><plugins> <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><transformerimplementation='org.apache.maven.plugins.shade.resource.ManifestResourceTransformer'> <mainClass>com.defonds.RsaEncryptor</mainClass></transformer><transformerimplementation='org.apache.maven.plugins.shade.resource.AppendingTransformer'> <resource>META-INF/spring.handlers</resource></transformer><transformerimplementation='org.apache.maven.plugins.shade.resource.AppendingTransformer'> <resource>META-INF/spring.schemas</resource></transformer> </transformers></configuration> </execution></executions> </plugin></plugins> </build></project>
parent_app pom.xml
<project xmlns='http://maven.apache.org/POM/4.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd'> <parent><artifactId>iot_cloud</artifactId><groupId>com.iot.nero</groupId><version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>parent_app</artifactId> <packaging>jar</packaging> <name>parent_app</name> <url>http://maven.apache.org</url> <properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies><dependency> <groupId>com.iot.nero</groupId> <artifactId>parent</artifactId> <version>1.0-SNAPSHOT</version></dependency> </dependencies></project>
parent pom.xml
<project xmlns='http://maven.apache.org/POM/4.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd'> <parent><artifactId>iot_cloud</artifactId><groupId>com.iot.nero</groupId><version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>parent</artifactId> <packaging>jar</packaging> <name>parent</name> <url>http://maven.apache.org</url> <properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies><!--ttest--> </dependencies></project>
common pom.xml
<project xmlns='http://maven.apache.org/POM/4.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd'> <parent><artifactId>iot_cloud</artifactId><groupId>com.iot.nero</groupId><version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>common</artifactId> <packaging>jar</packaging> <name>common</name> <url>http://maven.apache.org</url> <properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies><dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.12</version></dependency><dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>1.1.1</version></dependency><dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.1.1</version></dependency><!--database --><!--database --><dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.35</version> <scope>runtime</scope></dependency><dependency> <groupId>c3p0</groupId> <artifactId>c3p0</artifactId> <version>0.9.1.2</version></dependency><!--dao--><dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>3.3.0</version></dependency><dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> <version>1.2.3</version></dependency><!--json --><!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core --><dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.5.4</version></dependency><dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.5.4</version></dependency><!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations --><dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>2.5.4</version></dependency><dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version></dependency><!--spring--><dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>4.1.7.RELEASE</version></dependency><dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>4.1.7.RELEASE</version></dependency><dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>4.1.7.RELEASE</version></dependency><dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>4.1.7.RELEASE</version></dependency><dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>4.1.7.RELEASE</version></dependency><dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>4.1.7.RELEASE</version></dependency><dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>4.1.7.RELEASE</version></dependency><!--spring test--><dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>4.1.7.RELEASE</version></dependency><!-- https://mvnrepository.com/artifact/javax.mail/mail --><dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.5.0-b01</version></dependency><!-- https://mvnrepository.com/artifact/org.apache.commons/commons-email --><dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-email</artifactId> <version>1.4</version></dependency><!--RPC framework--><dependency> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> <version>5.0.0.Alpha2</version></dependency><!--阿里巴巴dubbo依赖--><dependency> <groupId>com.alibaba</groupId> <artifactId>dubbo</artifactId> <version>2.5.3</version> <exclusions><exclusion> <artifactId>spring</artifactId> <groupId>org.springframework</groupId></exclusion> </exclusions></dependency><!--注册中心依赖--><dependency> <groupId>org.ow2.util.bundles</groupId> <artifactId>zookeeper-3.3.1</artifactId> <version>1.0.0</version></dependency><!--zkclient--><dependency> <groupId>com.github.sgroschupf</groupId> <artifactId>zkclient</artifactId> <version>0.1</version></dependency> </dependencies> <excludes><exclude>META-INF/*.SF</exclude><exclude>META-INF/*.DSA</exclude><exclude>META-INF/*.RSA</exclude><exclude>junit:junit</exclude> </excludes></project>
facade_app.jar
类都有两份求大神帮忙
问题解答
回答1:是不是因为
<excludes> <exclude>META-INF/*.SF</exclude> <exclude>META-INF/*.DSA</exclude> <exclude>META-INF/*.RSA</exclude></excludes>
然后再MAINFEST.ME 上又存在定义
相关文章:
1. docker-compose中volumes的问题2. debian - docker依赖的aufs-tools源码哪里可以找到啊?3. docker网络端口映射,没有方便点的操作方法么?4. PHP中的$this代表当前的类还是方法?5. docker不显示端口映射呢?6. angular.js - angular内容过长展开收起效果7. golang - 用IDE看docker源码时的小问题8. python的MySQLdb包rollback对create语句无效吗?9. html - 这种错位的时间轴怎么布局,然后用css实现?10. javascript - 用swiper.js实现h5多篇文章滑动 点击文章跳转全文是另外的页面 点击返回滑动界面怎么定位到相应的swiper_slide