Hello,
I took a quick look at the reproducing project you linked
(https://github.com/cerveada/shade-plugin-issue) and I think the reason for the
behavior you are seeing is the content of <dependencyManagement> section in the
bundle/pom.xml:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.12</artifactId>
<version>2.4.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-parent_2.12</artifactId>
<version>2.4.8</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
You are specifying a provided scope for spark-core_2.12, and at the same time
changing the scope for some of its transitive dependencies when importing the
dependencyManagement from the spark-parent_2.12 POM.
You should be able to see the resulting dependency tree (with scopes) by
running 'mvn dependency:3.5.0:tree'. If I remove the spark-parent_2.12 from the
<dependencyManagement> section, then I am seeing the result you are probably
expecting - everything is provided and the shaded jar is basically empty.
I believe this is the current expected behavior when it comes to
scopes/dependencyManagement in Maven. You would probably need to override the
scope for all of the transitive dependencies as well, or remove the
spark-parent_2.12 import.
Thanks,
Petr
------- Original Message -------
On Wednesday, February 8th, 2023 at 14:13, Adam Cervenka (ZA)
<[email protected]> wrote:
>
>
> Hello,
>
> I would like to report a bug.
>
> I declared a dependency as provided, but the shade plugin still includes its
> transitive dependencies in the uber-jar.
>
> To demonstrate the issue, I created following repository:
> https://github.com/cerveada/shade-plugin-issue
>
> Using the poms and instructions in the repo it should be easy to replicate
> the issue.
>
> Thanks,
> Adam Cervenka
>
> Absa Bank Limited is a subsidiary of Absa Group Limited and is an Authorised
> Financial Services Provider and Registered Credit Provider, registration
> number: NCRCP7.
>
> Absa Bank Limited provides services to Absa Group Limited and its
> subsidiaries.
>
> Absa is committed to complying with applicable data privacy laws and to
> safeguarding the privacy and security of the personal information it collects
> and processes, in respect of all current and prospective clients. To
> understand more about how we collect, store, and process your personal
> information, please view our privacy statement at absa.co.za
>
> This e-mail and any attachments are confidential and intended solely for the
> addressee and may also be privileged or exempt from disclosure under
> applicable law. If you are not the addressee, or have received this e-mail in
> error, please notify the sender immediately, delete it from your system and
> do not copy, disclose or otherwise act upon any part of this e-mail or its
> attachments. Internet communications are not guaranteed to be secure or
> virus-free. We do not accept responsibility for any loss arising from
> unauthorised access to, or interference with, any Internet communications by
> any third party, or from the transmission of any viruses. We may monitor
> replies to this e-mail for operational or business reasons. Any opinion or
> other information in this e-mail or its attachments that does not relate to
> our business is personal to the sender and we do not endorse it.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]