shade plugin: no way to exclude artifact by version?

View: New views
1 Messages — Rating Filter:   Alert me  

shade plugin: no way to exclude artifact by version?

by Scott Parkerson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Greetings all.

I'm using the shade plugin (version 1.2.1) and attempting to build an  
über JAR file for my project. This project depends on Apache CXF  
(2.2.1-fuse), which in turn pulls in Spring Web 2.5.5, which also  
pulls in Spring Beans, Spring Context, and Spring Core (all version  
2.5.5).

The problem is that my master POM already pulls in Spring 2.5.6.A as a  
direct dependency. So, I want to screen out the 2.5.5 versions of  
Spring artifacts so it won't package 2.5.5 (and warn about 2.5.6.A  
being dupes).

I visited http://maven.apache.org/plugins/maven-shade-plugin/examples/includes-excludes.html 
. I noted that the examples don't specify an artifact by exact  
version, just by groupId:artifactId, but the docs seem to imply that  
groupId:artifactId:packaging:version would work, so I put this in my  
POM:


            <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-shade-plugin</artifactId>
                 <version>1.2.1</version>
                 <executions>
                     <execution>
                         <phase>package</phase>
                         <goals>
                             <goal>shade</goal>
                         </goals>
                         <configuration>
                             <artifactSet>
                                 <excludes>
                                   <exclude>org.springframework:spring-
context:jar:2.5.5</exclude>
                                   <exclude>org.springframework:spring-
beans:jar:2.5.5</exclude>
                                   <exclude>org.springframework:spring-
core:jar:2.5.5</exclude>
                                   <exclude>org.springframework:spring-
web:jar:2.5.5</exclude>
                                   <exclude>commons-logging:commons-
logging:jar:1.1.1</exclude>
                                 </excludes>
                             </artifactSet>
                             <transformers>
                                 <transformer  
implementation
="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                     
<mainClass>com.ateb.dataproc.obc_webservice_mckesson.StandaloneServer</
mainClass>
                                 </transformer>
                             </transformers>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>

However, this didn't work; the artifacts were packaged anyways, and  
the build complained bitterly about duplicate classes.

The only way I could get this to work was to remove ":jar:<version>"  
from the <exclude> and rely on the dumb luck that Spring changed their  
artifactId naming scheme between 2.5.5 and 2.5.6.A.

Is this the way it's supposed to work, or have I stumbled over a  
corner case? Or am I doing it wrong?

Thanks.

--sgp
cf. http://www.smerpology.org/




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...