G-Rath / osv-detector

MIT License
61 stars 8 forks source link

fix: use the first version when a dependency is listed multiple times in `pom.xml` files #229

Closed G-Rath closed 11 months ago

G-Rath commented 11 months ago

Per https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Transitive_Dependencies

Note that if two dependency versions are at the same depth in the dependency tree, the first declaration wins.

It doesn't seem to explicitly mention what happens when there are duplicate packages for dependency management so I've assumed it follows the same behaviour.

G-Rath commented 11 months ago

Turns out that Maven itself doesn't follow this so for now let's keep it as-is since that's the more real-world behaviour.

See https://github.com/google/osv-scanner/issues/589#issuecomment-1762515322