Dennis Melzer created TIKA-5066:
-----------------------------------

             Summary: 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


{{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