Detect version range usage in project or transitive dependencies#206
Detect version range usage in project or transitive dependencies#206slawekjaranowski wants to merge 2 commits intoapache:masterfrom
Conversation
|
For clarity: what do you do when a range is detected? In which goals? |
According to new option |
|
ok, now I understand the intent (= what should be in the PR description) I love detecting version ranges, I'm torn on failing I would not hesitate on I know that I'll have to de-activate I'll probably have to accept this PR: I love the warning that I'll get when disabling what I'd like after this PR is to see if we can have:
|
ok, we can add a message to
|
|
Next idea warn on |
|
I'm thinking at this very concrete example: https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/io/cucumber/gherkin/README.md Where they use ranges, and:
in this case, when another version is resolved that the initial build, it has an impact on the more I write, the more I think we're not describing the same "Reproducible Builds" semantics But in general, version ranges that give "un-stable over time" resolution is not impacting "Reproducible Builds" in terms of getting the same output that being said, what to put in what would describe the gherkin case? Perhaps even in |
|
@cstamas are there some properties which reduce ranges resolving ? |
|
Yes, in Resolver 2/Maven 4. Those may be possible in Maven 3.10.x as well. These are global ones (affecting whole system/session). I want to make platform support too, but I am currently derailed. |
|
@hboutemy we will can filter range in Maven 4.x, 3.10.x so we can add instruction to buildinfo 😄 |
6db0910 to
6389fc6
Compare
6389fc6 to
d677259
Compare
that will be great |
|
@hboutemy next proposition, PR description also updated |
hboutemy
left a comment
There was a problem hiding this comment.
I love the result: proposed changes are only reader proofing
| assert buildLog.contains('[ERROR] Version with range found in dependencies, project can be non-reproducible') | ||
| assert buildLog.contains(' - Dependency io.cucumber:messages:jar:32.2.0 (compile) via io.cucumber:gherkin:jar:38.0.0 is referenced with a range version [32.0.0,33.0.0)') | ||
| assert buildLog.contains(' - Dependency commons-io:commons-io:jar:2.21.0 (compile) is referenced with a range version [2.20.0,)') | ||
| assert buildLog.contains(' - Dependency commons-collections:commons-collections:jar:LATEST (compile) is referenced with a range version LATEST') |
There was a problem hiding this comment.
should probably also assert that commons-lang3 dependency is not flagged
| Map<DependencyNode, String> versionRangeDependencies = | ||
| rangesUtil.findVersionRangeDependencies(session, project); | ||
| if (!versionRangeDependencies.isEmpty()) { | ||
| String message = "Version with range found in dependencies, project can be non-reproducible" |
There was a problem hiding this comment.
Version => Version specification
(this is the opportunity to clarify that in POM, this is a version specification)
can be => may
project => build
| } | ||
| result.put( | ||
| node, | ||
| "Dependency " + node.getDependency() + path + " is referenced with a range version " |
There was a problem hiding this comment.
is referenced with => has been resolved from
range version => version range
Summary
This PR adds version-range awareness to the artifact plugin to improve reproducibility checks.
What changed
RangesUtilto detect direct and transitive dependencies that use version ranges (includingLATEST/RELEASE).artifact:check-buildplan..buildinfofiles via:mvn.rebuild-args=-Dmaven.session.versionFilter=...failOnNonReproducible=false),Following this checklist to help us incorporate your
contribution quickly and easily:
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
mvn verifyto make sure basic checks pass.A more thorough check will be performed on your pull request automatically.
mvn -Prun-its verify).If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.