[
https://jira.codehaus.org/browse/MSHADE-176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=353144#comment-353144
]
Taylor Jones commented on MSHADE-176:
-------------------------------------
I wasn't able to do it with filters, but it's certainly possible I just
misunderstood how they work. Below is the POM I'm testing with:
{code}
<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>com.example</groupId>
<artifactId>neo4j-example</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<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>
<createDependencyReducedPom>false</createDependencyReducedPom>
<filters>
<filter>
<artifact>org.neo4j:neo4j-kernel</artifact>
<excludes>
<exclude>org.neo4j.helpers.collection.WrappingResourceIterator</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j-rest</artifactId>
<version>3.0.1.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
{code}
I always get this warning message when I run {{mvn clean package}}:
{code}
[WARNING] neo4j-rest-graphdb-2.0.1.jar, neo4j-kernel-2.0.1.jar define 1
overlappping classes:
[WARNING] - org.neo4j.helpers.collection.WrappingResourceIterator
[WARNING] maven-shade-plugin has detected that some .class files
[WARNING] are present in two or more JARs. When this happens, only
[WARNING] one single version of the class is copied in the uberjar.
[WARNING] Usually this is not harmful and you can skeep these
[WARNING] warnings, otherwise try to manually exclude artifacts
[WARNING] based on mvn dependency:tree -Ddetail=true and the above
[WARNING] output
[WARNING] See http://docs.codehaus.org/display/MAVENUSER/Shade+Plugin
{code}
> Suppress warning output
> -----------------------
>
> Key: MSHADE-176
> URL: https://jira.codehaus.org/browse/MSHADE-176
> Project: Maven Shade Plugin
> Issue Type: Improvement
> Reporter: Taylor Jones
> Fix For: 2.4
>
> Attachments: suppressWarnings_option.patch
>
>
> The warnings Shade outputs are useful, but there are some cases where nothing
> can actually be done about them. Recently, I encountered this with the Neo4j
> libraries; there is one overlapping class between two critical JARs (kernel
> and rest), and no way to resolve this via exclusions.
> In these cases, everything works just fine. At best, the warnings are just
> noise, but we also have some build processes in place that will fail on Maven
> warnings. I figured this would be a pretty simple thing to just suppress, but
> Shade doesn't seem to have a way to do this.
> I've included a simple patchset to address this which adds a new option to
> the configuration called <suppressWarnings>. There isn't a unit test
> attached, unfortunately. I'm not quite sure how to unit test logging output
> in this fashion without something akin to Mockito. I figured you guys
> wouldn't appreciate me adding dependencies out of the blue but if a unit test
> is required, I can give it a shot.
--
This message was sent by Atlassian JIRA
(v6.1.6#6162)