[ https://issues.apache.org/jira/browse/MNG-7842?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17747755#comment-17747755 ]
Vladimir Sitnikov commented on MNG-7842: ---------------------------------------- {quote}Maven does not consider "partial models", it considers "model" that is successfully built (and validated){quote} That is not true. Maven considers the partial models, and it discards the information. Cosider: A) User declares dependency without a version. Maven would fail the build with "Some problems were encountered while processing the POMs.." B) User declares dependency that references a dependency without a version. Maven happily performs a build ignoring **all** the dependencies in the pom that happens to contain "versionless" dependency. {quote} Also, to have depMgmt applied, you have to have Model to apply to{quote} Could you please rephrase so I could better understand what you suggest? What I say is that **even if I declare dependencyManagement** locally, Maven still ignores the pom that contains "versionless dependency". > 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 > Priority: Major > > I have a problem that Maven discards **all** transitive dependencies when a > single of them misses {{<version>}}. It breaks workflows, and it is not clear > why Maven behaves like that. > I'm using Maven 3.8.6. > 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)