我正在尝试创建一个阴影 jar 文件,但阴影插件给了我警告。我不知道如何解决它们。
这是我的 pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>example.shade.group</groupId>
<artifactId>myproj-shade-kryo</artifactId>
<name>myproj-shade-kryo</name>
<version>1.0.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.esotericsoftware.kryo</groupId>
<artifactId>kryo</artifactId>
<version>2.21</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<DependencyConvergence/>
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.2</version>
<executions>
<execution>
<id>package</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
警告是:
[INFO] --- maven-shade-plugin:2.4.2:shade (package) @ myproj-shade-kryo ---
[INFO] Including com.esotericsoftware.kryo:kryo:jar:2.21 in the shaded jar.
[INFO] Including com.esotericsoftware.reflectasm:reflectasm:jar:shaded:1.07 in the shaded jar.
[INFO] Including org.ow2.asm:asm:jar:4.0 in the shaded jar.
[INFO] Including com.esotericsoftware.minlog:minlog:jar:1.2 in the shaded jar.
[INFO] Including org.objenesis:objenesis:jar:1.2 in the shaded jar.
[WARNING] minlog-1.2.jar, kryo-2.21.jar define 2 overlapping classes:
[WARNING] - com.esotericsoftware.minlog.Log
[WARNING] - com.esotericsoftware.minlog.Log$Logger
[WARNING] reflectasm-1.07-shaded.jar, kryo-2.21.jar define 23 overlapping classes:
[WARNING] - com.esotericsoftware.reflectasm.shaded.org.objectweb.asm.Opcodes
[WARNING] - com.esotericsoftware.reflectasm.AccessClassLoader
[WARNING] - com.esotericsoftware.reflectasm.shaded.org.objectweb.asm.Label
[WARNING] - com.esotericsoftware.reflectasm.shaded.org.objectweb.asm.ClassWriter
[WARNING] - com.esotericsoftware.reflectasm.shaded.org.objectweb.asm.AnnotationVisitor
[WARNING] - com.esotericsoftware.reflectasm.shaded.org.objectweb.asm.Type
[WARNING] - com.esotericsoftware.reflectasm.FieldAccess
[WARNING] - com.esotericsoftware.reflectasm.ConstructorAccess
[WARNING] - com.esotericsoftware.reflectasm.shaded.org.objectweb.asm.ClassVisitor
[WARNING] - com.esotericsoftware.reflectasm.shaded.org.objectweb.asm.Edge
[WARNING] - 13 more...
[WARNING] objenesis-1.2.jar, kryo-2.21.jar define 32 overlapping classes:
[WARNING] - org.objenesis.ObjenesisBase
[WARNING] - org.objenesis.instantiator.gcj.GCJInstantiator
[WARNING] - org.objenesis.ObjenesisHelper
[WARNING] - org.objenesis.instantiator.jrockit.JRockitLegacyInstantiator
[WARNING] - org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator
[WARNING] - org.objenesis.instantiator.ObjectInstantiator
[WARNING] - org.objenesis.instantiator.gcj.GCJInstantiatorBase$DummyStream
[WARNING] - org.objenesis.instantiator.basic.ObjectStreamClassInstantiator
[WARNING] - org.objenesis.ObjenesisException
[WARNING] - org.objenesis.Objenesis
[WARNING] - 22 more...
[WARNING] maven-shade-plugin has detected that some class files are
[WARNING] present in two or more JARs. When this happens, only one
[WARNING] single version of the class is copied to the uber jar.
[WARNING] Usually this is not harmful and you can skip these warnings,
[WARNING] otherwise try to manually exclude artifacts based on
[WARNING] mvn dependency:tree -Ddetail=true and the above output.
[WARNING] See http://maven.apache.org/plugins/maven-shade-plugin/
我也试过了,mvn dependency:tree -Ddetail=true
但这并没有给我任何解决方法的线索:
[INFO] ------------------------------------------------------------------------
[INFO] Building myproj-shade-kryo 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ myproj-shade-kryo ---
[INFO] example.shade.group:myproj-shade-kryo:jar:1.0.0-SNAPSHOT
[INFO] \- com.esotericsoftware.kryo:kryo:jar:2.21:compile
[INFO] +- com.esotericsoftware.reflectasm:reflectasm:jar:shaded:1.07:compile
[INFO] | \- org.ow2.asm:asm:jar:4.0:compile
[INFO] +- com.esotericsoftware.minlog:minlog:jar:1.2:compile
[INFO] \- org.objenesis:objenesis:jar:1.2:compile
[INFO] ------------------------------------------------------------------------