I referred to this thread differences between dependencymanagement and dependencies in maven but this question is specific.
Parent POM:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.company.rtdp.rtds</groupId>
<artifactId>rtds-client</artifactId>
<version>${rtdp.rtds-client.version}</version>
<!-- SCENARIO 1 : Either give scope here in parent POM -->
<!-- <scope>provided</scope> -->
</dependency>
</dependencies>
</dependencyManagement>
<rtdp.rtds-client.version>1.4.6</rtdp.rtds-client.version>
Child POM:
<dependencies>
<!-- SCENARIO 2
<dependency>
<groupId>com.company.rtdp.rtds</groupId>
<artifactId>realtimedataserv-client</artifactId>
<version>1.4.6</version>
<scope>provided</scope>
</dependency>
-->
<dependency>
<groupId>com.company.idi</groupId>
<artifactId>idi-persistence</artifactId>
<version>3.3</version>
<!-- has a dependency of com.company.rtdp.rtds:rtds-client:jar:1.4.6:compile -->
</dependency>
</dependencies>
<!-- SCENARIO 1: OR give scope here in child POM
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.company.rtdp.rtds</groupId>
<artifactId>rtds-client</artifactId>
<version>1.4.6</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
-->
rtds-client is a transitive dependency of many artifacts out of which idi-persistence is one of them. I want to exclude 1.4.6 in all of the transitive dependencies since I am going to include a different artifact rtds-framework-client (different artifact name) explicitly which is backward compatible to 1.4.6 with <dependency> in child POM.
If have to use <exclusion> I have to explicitly give this in all the dependencies. So, I have decided to go <scope>provided</scope> way.
Known info of Maven based on which my question follows:
If I include the following in child POM (with a version higher than 1.4.6, then rtds-client in all transitive dependencies gets shifted to 1.8. I could see this from 'Dependency Hierarchy' of Eclipse which says 'omitted for conflict with 1.8' [compile]) which means it considers/overrides the version specified in child POM (idi-persistence now gets 1.8).
<dependency>
<groupId>com.company.rtdp.rtds</groupId>
<artifactId>rtds-client</artifactId>
<version>1.8</version>
</dependency>
Question:
If I include the following in child POM without <dependencyManagement> around:
<dependency>
<groupId>com.company.rtdp.rtds</groupId>
<artifactId>rtds-client</artifactId>
<version>1.4.6</version>
<scope>provided<scope>
</dependency>
None of the rtds-client which comes as transitive dependency considers provided scope whereas I mention the same in a <dependencyManagement> tag either in parent or child POM, provided scope gets applied.
Why version gets affected but not scope given inside <dependency> tag and for scope (for this kind of use case) I have to go for <dependencyManagement> ?
Say if this is allowed, what problem it would lead us into ?
EDIT:
i) <scope>provided with <dependencyManagement>/<dependencies>/<dependency> either in child or parent POM:
Though the longer path is omitted, it says [provided],here.
[INFO] +- com.company.idi:idi-persistence:jar:3.3:compile
[INFO] | +- com.company.rtdp.rtds:realtimedataserv-client:jar:1.4.6:provided
ii) <scope>provided with direct <dependencies>/<dependency> in child POM without <dependencyManagement> around :
Though the longer path is omitted, it does not say provided and just compile alone.
[INFO] --- maven-dependency-plugin:2.3:tree (default-cli) @ read-rest-service ---
[INFO] +- com.company.rtdp.rtds:realtimedataserv-client:jar:1.4.6:provided (scope not updated to compile)

