Bất kỳ ai có bất kỳ ý tưởng gì đã xảy ra với việc xây dựng maven của tôi? Tôi nhận được rất nhiều cảnh báo trùng lặp.Maven xây dựng [CẢNH BÁO] chúng tôi có một lớp trùng lặp
[WARNING] We have a duplicate org/apache/commons/logging/impl/LogFactoryImpl$1.class in /home/shengjie/.m2/repository/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar
[WARNING] We have a duplicate org/apache/commons/logging/impl/LogFactoryImpl.class in /home/shengjie/.m2/repository/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar
[WARNING] We have a duplicate org/apache/commons/logging/impl/NoOpLog.class in /home/shengjie/.m2/repository/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar
[WARNING] We have a duplicate org/apache/commons/logging/impl/SimpleLog$1.class in /home/shengjie/.m2/repository/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar
[WARNING] We have a duplicate org/apache/commons/logging/impl/SimpleLog.class in /home/shengjie/.m2/repository/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar
[WARNING] We have a duplicate org/apache/commons/logging/impl/Jdk14Logger.class in /home/shengjie/.m2/repository/commons-logging/commons-logging-api/1.0.4/commons-logging-api-1.0.4.jar
Tôi đã xem xét repo m2 cục bộ của mình, tôi có hai lớp trong đó commons-logging-api jar, LogFactoryImpl.class và LogFactoryImpl $ 1.class. Giống như tất cả các lớp được đề cập trong các cảnh báo.
Một điều cần lưu ý là tôi đang sử dụng plugin bóng râm trong tệp pom.xml của mình.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.~~~~black out my own main class here~~~~~</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
tôi nhận thấy rằng các cây phụ thuộc trông giống như dưới đây
[INFO] +- org.apache.cxf:cxf-bundle-jaxrs:jar:2.5.1:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] \- org.apache.hadoop.hive:hive-jdbc:jar:0.7.1-cdh3u3:compile
[INFO] \- org.apache.hadoop.hive:hive-common:jar:0.7.1-cdh3u3:compile
[INFO] \- commons-logging:commons-logging-api:jar:1.0.4:compile
và commons-logging.jar và commons-logging-api.jar cả hai đều có org/apache/commons/đăng nhập/LogFactory. lớp học.
bằng cách nào đó plugin Shad đang cố gắng ép chúng vào một lọ lớn chất béo ở cuối. sau đó cảnh báo sẽ hiển thị. Nó được cho biết đây là cảnh báo đáng nể. Nhưng tôi hơi lo lắng, Làm thế nào để ứng dụng biết lớp chính xác nên được sử dụng nếu có hai lớp trùng lặp có cùng tên?
LogFactoryImpl.class và LogFactoryImpl $ 1.class lớp với $ 1 trong tên là lớp địa phương bên trong LogFactoryImpl. – khmarbaise