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

ASF GitHub Bot commented on TIKA-5066:
--------------------------------------

MelleD opened a new pull request, #3628:
URL: https://github.com/apache/tika/pull/3628

   Fix https://issues.apache.org/jira/browse/TIKA-5066
   
   Problem
   tika-bom is not usable together with spring-boot-starter-parent (or any 
project that wants to control its own third-party versions).
   
   tika-bom inherits from tika-parent. The flatten-maven-plugin configured in 
tika-parent uses flattenMode=resolveCiFriendliesOnly, so the published tika-bom 
still declares tika-parent as its parent. tika-parent imports a number of 
third-party BOMs, for example:
   
   ```
   <dependency>
     <groupId>io.netty</groupId>
     <artifactId>netty-bom</artifactId>
     <version>${netty.version}</version>
     <type>pom</type>
     <scope>import</scope>
   </dependency>
   ```
   When a consumer imports tika-bom, Maven resolves its parent chain and all of 
these managed versions (netty, jackson, jetty, grpc, log4j, ...) leak into the 
consumer's dependencyManagement, overriding versions managed by e.g. Spring 
Boot.
   
   Steps to reproduce see Ticket
   
   Fix is same approach as Apache Jena 
(https://github.com/apache/jena/issues/4107, commit 
[e1211db](https://github.com/apache/jena/commit/e1211dbd88649a374fc46cb61efe161b4df1a9f7)):
   
   Override flatten-maven-plugin in tika-bom/pom.xml with flattenMode=bom. The 
flattened (published) BOM no longer has a <parent> and only contains Tika's own 
dependencyManagement; third-party BOM imports from tika-parent are gone.
   Keep ${revision} for the BOM entries and use properties=resolve, so the 
flattened BOM defines revision and the entries stay resolvable for consumers. 
(Properties of an imported BOM do not affect the consumer's dependency 
management.)
   The plugin version is already managed in tika-parent, so no other change is 
needed.
   
   Verification
   tika-bom/.flattened-pom.xml contains no <parent> and no 
<scope>import</scope>. It has only the 90 org.apache.tika entries with 
${revision}, which is defined in the resolved <properties>.
   The consumer project above resolves Spring Boot's Netty version after the 
change and Tika's version before it. tika-core still resolves to the Tika 
version (4.3.0-SNAPSHOT via ${revision}).
   
   
   
   




> BOM is not usable with spring-boot-starter-parent
> -------------------------------------------------
>
>                 Key: TIKA-5066
>                 URL: https://issues.apache.org/jira/browse/TIKA-5066
>             Project: Tika
>          Issue Type: Bug
>            Reporter: Dennis Melzer
>            Priority: Major
>
> {{tika-bom}} is not usable together with {{{}spring-boot-starter-parent{}}}.
> {{tika-bom}} inherits from {{{}tika-parent{}}}. The {{flatten-maven-plugin}} 
> configured in {{tika-parent}} uses 
> {{{}flattenMode=resolveCiFriendliesOnly{}}}, so the published {{tika-bom}} 
> still declares {{tika-parent}} as its parent. {{tika-parent}} imports a 
> number of third-party BOMs, for example:
> <dependency>
>   <groupId>io.netty</groupId>
>   <artifactId>netty-bom</artifactId>
>   <version>${netty.version}</version>
>   <type>pom</type>
>   <scope>import</scope>
> </dependency>
>  
> When a consumer imports {{{}tika-bom{}}}, Maven resolves its parent chain and 
> all of these managed versions (netty, jackson, jetty, grpc, log4j, ...) leak 
> into the consumer's {{{}dependencyManagement{}}}, overriding versions managed 
> by e.g. Spring Boot.
> h3. Steps to reproduce
> <project>
>   <modelVersion>4.1.2</modelVersion>
>   <parent>
>     <groupId>org.springframework.boot</groupId>
>     <artifactId>spring-boot-starter-parent</artifactId>
>     <version>4.1.2</version>
>   </parent>
>   <groupId>x</groupId>
>   <artifactId>consumer</artifactId>
>   <version>1</version>
>   <properties>
>     <netty.version>4.2.20.Final</netty.version>
>   </properties>
>   <dependencyManagement>
>     <dependencies>
>       <dependency>
>         <groupId>org.apache.tika</groupId>
>         <artifactId>tika-bom</artifactId>
>         <version>4.2.0</version>
>         <type>pom</type>
>         <scope>import</scope>
>       </dependency>
>     </dependencies>
>   </dependencyManagement>
>   <dependencies>
>     <dependency>
>       <groupId>io.netty</groupId>
>       <artifactId>netty-codec-http</artifactId>
>     </dependency>
>   </dependencies>
> </project>
>  
> Run {{mvn help:effective-pom}} or {{{}mvn dependency:tree{}}}:
> || ||{{netty-codec-http}} version||
> |without this PR|{{4.2.20.Final}} (from Tika's {{{}netty-bom{}}})|
> |with this PR|{{4.1.128.Final}} (managed by Spring Boot, as expected)|
>  



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to