question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use exact maven versions

See original GitHub issue

What version of gRPC-Java are you using?

1.38.0

What is your environment?

Maven

What did you expect to see?

Developers and DevOps people that build CI/CD pipelines expect builds to be reproducible and deterministic. If we build a project today or next year (assuming the same exact commit id), we expect the same binary to be built. That is not the case with the grpc maven artifacts.

For example, snapshots are discouraged from being used in production builds because they can be overwritten with newer code or completely deleted; either changing application behavior or breaking the build.

What did you see instead?

When building the project using maven it will reach out across the network to check for a newer version of grpc to build with. This opens the project to builds that are not deterministic.

Steps to reproduce the bug

I have a maven project that uses grpc-okhttp, and I execute mvn clean install. Observe the output contains

[INFO] Building Project 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from atlassian-public: https://packages.atlassian.com/mvn/maven-external/io/grpc/grpc-api/maven-metadata.xml
Downloading from sourceforge-releases: https://oss.sonatype.org/content/repositories/sourceforge-releases/io/grpc/grpc-api/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/io/grpc/grpc-api/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/io/grpc/grpc-api/maven-metadata.xml (1.7 kB at 3.3 kB/s)
Downloaded from atlassian-public: https://packages.atlassian.com/mvn/maven-external/io/grpc/grpc-api/maven-metadata.xml (1.7 kB at 2.6 kB/s)

Expected Resolution

Please consider updating this line of code so that it stops wrapping the version with [ ] and use only specific version numbers:

https://github.com/grpc/grpc-java/blob/master/build.gradle#L411

core.version*.value = "[" + core.version.text() + "]"

Instead of [1.38.0] (which causes the network activity), the unwrapped value 1.38.0 is the expected output.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ejona86commented, Jul 28, 2021

You’ve convinced me that the brackets do serve a functional and required purpose.

I can imagine one day they may cause more pain than gain. For example, BOMs have reduced the likelihood of issues and Gradle users don’t seemed to have suffered very often, given the rate of user reports. But yes, it is providing some value.

I’ll work around the network issue using a workaround on my end. I still don’t want it to output the network access during builds.

Do keep in touch if you continue to suffer and if --offline doesn’t work for you. Your use-case is also legit. We just get to continue weighing the costs/benefits.

Closing as it seems we’ve come to an understanding, but if something changes comment and we can reopen.

0reactions
nkaviancommented, Jul 28, 2021

Thanks for finding and sharing that dependency version link. I understand more clearly your point about soft/hard dependencies and the dependency tree. I also appreciate requireUpperBoundDeps and I’ll try to implement it as well, it looks like the right thing to do.

You’ve convinced me that the brackets do serve a functional and required purpose. I’ll work around the network issue using a workaround on my end. I still don’t want it to output the network access during builds.

Read more comments on GitHub >

github_iconTop Results From Across the Web

7 Understanding Maven Version Numbers - Oracle Help Center
When Maven encounters multiple matches for a version reference, it uses the highest matching version. Generally, version references should be only as specific ......
Read more >
How do I tell Maven to use the latest version of a dependency?
versions :use-latest-releases searches the pom for all non-SNAPSHOT versions which have been a newer release and replaces them with the latest release version....
Read more >
Versions Maven Plugin – versions:use-dep-version - MojoHaus
Updates a dependency to a specific version. This can be useful if you have to manage versions for a very large (100+ module)...
Read more >
Apache Maven Enforcer Built-In Rules – Version Range ...
Version Range Specification. The RequireMavenVersion and RequireJavaVersion rules use the standard Maven version range syntax with one minor ...
Read more >
Legit but Useless: Maven Version Ranges Explained
We can give up and use one exact version: 3.141. · We can make up a version that will –probably– never be reached...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found