Vladimir Sitnikov created MNG-7842:
--------------------------------------

             Summary: Keep using transitive dependencies even if one of the 
declarations misses a version
                 Key: MNG-7842
                 URL: https://issues.apache.org/jira/browse/MNG-7842
             Project: Maven
          Issue Type: Improvement
          Components: Core, Dependencies
            Reporter: Vladimir Sitnikov


I have a problem that Maven discards **all** transitive dependencies.

Sample:

{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/xsd/maven-4.0.0.xsd";>
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>TestBugMaven</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.jmeter</groupId>
            <artifactId>ApacheJMeter_core</artifactId>
            <version>5.6.1</version>
        </dependency>
    </dependencies>
</project>
{code}

Test: {{mvn dependency:tree}}

Output:

{noformat}
[WARNING] The POM for org.apache.jmeter:ApacheJMeter_core:jar:5.6.1 is invalid, 
transitive dependencies (if any) will not be available, enable debug logging 
for more details
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ TestBugMaven ---
[INFO] org.example:TestBugMaven:jar:1.0-SNAPSHOT
[INFO] \- org.apache.jmeter:ApacheJMeter_core:jar:5.6.1:compile
{noformat}

Frankly speaking, I do not understand why Maven discards ALL transitive 
dependencies in case it observes a single one with "missing version".

Note: adding {{dependencyManagement}} does not seem to fix the case, so it is 
even more confusing.

The following still discards transitive dependencies:

{code:xml}
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.google.auto.service</groupId>
      <artifactId>auto-service-annotations</artifactId>
      <scope>compile</scope>
      <version>1.1.1</version>
    </dependency>
  </dependencies>
</dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.apache.jmeter</groupId>
            <artifactId>ApacheJMeter_core</artifactId>
            <version>5.6.1</version>
        </dependency>
    </dependencies>
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to