[ 
https://issues.apache.org/jira/browse/MSHADE-419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17598387#comment-17598387
 ] 

Christopher Lambert commented on MSHADE-419:
--------------------------------------------

i've created a PR with an IT and a proposed fix (but unsure about its general 
correctness):

[https://github.com/apache/maven-shade-plugin/pull/149]

We saw the problem as in the added IT in that module A attaches a shaded jar 
while module B tries to use the non-shaded jar from module A.

After upgrading to 3.3.0 B no longer receives the transitive dependencies of A 
(even though the pom in the jar of A is still correctly declaring them).

I am pretty sure it was introduced by MSHADE-321 
https://github.com/apache/maven-shade-plugin/pull/22

I am guessing this is related to in-memory modifications of the maven project 
model during the execution.

This might explain why this ticket refers to "deployed pom" in that the pom is 
deployed from memory not extracted from the generated jar ... but i am just 
guessing on this part really.

 

> Shade plugin causes pom to be created without compile dependencies
> ------------------------------------------------------------------
>
>                 Key: MSHADE-419
>                 URL: https://issues.apache.org/jira/browse/MSHADE-419
>             Project: Maven Shade Plugin
>          Issue Type: Bug
>    Affects Versions: 3.3.0
>            Reporter: BM
>            Priority: Critical
>              Labels: shade
>
> A project using shade-plugin 3.2.4 deploys with a pom containing all the 
> dependencies as defined.
> A project using shade-plugin 3.3.0 deploys with a pom containing only the 
> 'test' and 'provided' dependencies. This causes transitive dependency issues 
> for downstream projects.
>  
> {code:java}
> <?xml version="1.0"?>
> <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>test</groupId>
>     <artifactId>shade-apr-2022</artifactId>
>     <packaging>jar</packaging>
>     <version>1.0.0-SNAPSHOT</version>    
>     <properties>
>         <jackson-version>2.9.6</jackson-version>
>     </properties>    
>     <dependencies>        
>         <dependency>
>             <groupId>com.fasterxml.jackson.core</groupId>
>             <artifactId>jackson-core</artifactId>
>             <version>${jackson-version}</version>
>         </dependency>        
>         <dependency>
>             <groupId>com.fasterxml.jackson.core</groupId>
>             <artifactId>jackson-databind</artifactId>
>             <version>${jackson-version}</version>
>         </dependency>        
>         <dependency>
>             <groupId>com.fasterxml.jackson.core</groupId>
>             <artifactId>jackson-annotations</artifactId>
>             <version>${jackson-version}</version>
>         </dependency>        
>         <dependency>
>             <groupId>com.thoughtworks.xstream</groupId>
>             <artifactId>xstream</artifactId>
>             <version>1.4.10</version>
>         </dependency>        
>         <!-- Test dependencies -->
>         <dependency>
>             <groupId>junit</groupId>
>             <artifactId>junit</artifactId>
>             <version>4.11</version>
>             <scope>test</scope>
>         </dependency>
>     </dependencies>
>     <build>
>         <plugins>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-compiler-plugin</artifactId>
>                 <version>3.8.0</version>
>                 <configuration>
>                     <release>11</release>
>                 </configuration>
>             </plugin>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-shade-plugin</artifactId>
>                 <version>3.3.0</version>
>                 <executions>
>                     <execution>
>                         <phase>package</phase>
>                         <goals>
>                             <goal>shade</goal>
>                         </goals>
>                         <configuration>
>                             
> <shadedArtifactAttached>true</shadedArtifactAttached>
>                             <transformers>
>                                 <transformer
>                                     
> implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
>                                     
> <resource>META-INF/spring.handlers</resource>
>                                 </transformer>
>                                 <transformer
>                                     
> implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
>                                     
> <resource>META-INF/spring.factories</resource>
>                                 </transformer>
>                                 <transformer
>                                     
> implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
>                                     
> <resource>META-INF/spring.schemas</resource>
>                                 </transformer>
>                                 <transformer
>                                     
> implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"
>  />
>                             </transformers>
>                         </configuration>
>                     </execution>
>                 </executions>
>             </plugin>
>         </plugins>
>     </build>
> </project> {code}
> Dependencies in deployed pom with shade-plugin 3.2.4:
> {code:java}
> <dependencies>
>     <dependency>
>         <groupId>com.fasterxml.jackson.core</groupId>
>         <artifactId>jackson-core</artifactId>
>         <version>${jackson-version}</version> 
>     </dependency>
>     <dependency>
>         <groupId>com.fasterxml.jackson.core</groupId>
>         <artifactId>jackson-databind</artifactId>
>         <version>${jackson-version}</version>
>     </dependency>
>     <dependency>
>         <groupId>com.fasterxml.jackson.core</groupId>
>         <artifactId>jackson-annotations</artifactId>
>         <version>${jackson-version}</version>
>     </dependency>
>     <dependency>
>         <groupId>com.thoughtworks.xstream</groupId>
>         <artifactId>xstream</artifactId>
>         <version>1.4.10</version>
>     </dependency>
>     <!--  Test dependencies  -->
>     <dependency>
>         <groupId>junit</groupId>
>         <artifactId>junit</artifactId>
>         <version>4.11</version>
>         <scope>test</scope>
>     </dependency>
> </dependencies> {code}
> Dependencies in deployed pom with shade-plugin 3.3.0:
> {code:java}
> <dependencies>
>     <dependency>
>         <groupId>junit</groupId>
>         <artifactId>junit</artifactId>
>         <version>4.11</version>
>         <scope>test</scope>
>         <exclusions>
>             <exclusion>
>                 <artifactId>hamcrest-core</artifactId>
>                 <groupId>org.hamcrest</groupId>
>             </exclusion>
>         </exclusions>
>     </dependency>
> </dependencies> {code}
> Note also an exclusion on hamcrest-core. I don't know where that is coming 
> from.
> It looks to be related to the {{dependency-reduced-pom.xml}} but the 
> behaviour has changed in this plugin version.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to