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

Babak Vahdat commented on CAMEL-16041:
--------------------------------------

For sure as a workaround one can always use his own version to override that 
old inherited managed dependency from Camel:

{code:xml}
<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>${my.guava.version}</version>
</dependency>
{code}

Please also note that exclusion of managed dependencies [is currently not 
possible in Maven|https://github.com/apache/maven/pull/295].

And the real pain is the fact that the Maven managed dependencies have higher 
precedence over the transitive ones! In our case this old version from Camel 
overrided the version Wiremock [currently 
uses|https://github.com/tomakehurst/wiremock/blob/28c5e6737caa7887e2070033bd361501e12ea3ee/build.gradle#L39].
 And you would not even think of such a scenario until your tests start to 
fail. :-(



> The managed dependency version through Camel Spring Boot BOM for 
> com.google.guava:guava is from 2015
> ----------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-16041
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16041
>             Project: Camel
>          Issue Type: Task
>    Affects Versions: 3.7.0
>            Reporter: Babak Vahdat
>            Priority: Minor
>
> Consider the following sample application POM:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <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/maven-v4_0_0.xsd";>
>     <modelVersion>4.0.0</modelVersion>
>     <groupId>com.foo</groupId>
>     <artifactId>bar</artifactId>
>     <version>0.1.0-SNAPSHOT</version>
>     <dependencyManagement>
>         <dependencies>
>             <!-- Camel BOM -->
>             <dependency>
>                 <groupId>org.apache.camel.springboot</groupId>
>                 <artifactId>camel-spring-boot-bom</artifactId>
>                 <version>3.7.0</version>
>                 <type>pom</type>
>                 <scope>import</scope>
>             </dependency>
>         </dependencies>
>     </dependencyManagement>
>     <dependencies>
>         <dependency>
>             <groupId>com.google.guava</groupId>
>             <artifactId>guava</artifactId>
>         </dependency>
>     </dependencies>
> </project>
> {code}
> Then you would inherit the managed dependency version 
> [19.0|https://search.maven.org/artifact/com.google.guava/guava/19.0/bundle] 
> released in {{2015}}:
> {code:java|title=Bar.java|borderStyle=solid}
> $> mvn dependency:tree
> [INFO] Scanning for projects...
> [INFO] 
> [INFO] ----------------------------< com.foo:bar 
> >-----------------------------
> [INFO] Building bar 0.1.0-SNAPSHOT
> [INFO] --------------------------------[ jar 
> ]---------------------------------
> [INFO] 
> [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ bar ---
> [INFO] com.foo:bar:jar:0.1.0-SNAPSHOT
> [INFO] \- com.google.guava:guava:jar:19.0:compile
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  1.190 s
> [INFO] Finished at: 2021-01-15T08:19:47+01:00
> [INFO] 
> ------------------------------------------------------------------------
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to