I am a Java developer used to Maven and Gradle, now coming into .NET and trying to understand Paket. From my understanding, Paket has three different files supporting a .NET solution's dependency management:
With Maven and Gradle, I am used to specifying my dependencies in one file. I can specify exact versions, and be sure that subsequent downloads of the dependencies will be the same. Why does Paket need three files? I would expect that a paket.references file in each project would be sufficient. Is there some problem or quirk in .NET world in how dependencies are managed that I am ignorant of that this three files are needed?
The issue is not that there is anything unique about dependency management in .NET. It's that Gradle (as great as it is) and Maven are missing some key features when it comes to dependency management.
Each project specifies the version of each dependency separately. Consider these dependencies:
The two projects will build with two different versions of dependency X, even though they are ultimately destined for the same application. Arguably worse, the tests for each project will run with different versions of dependency X.
Paket solves this by specifying which project needs a dependency ('paket.references') and which version of a dependency should be used ('paket.dependencies') separately. This way multiple projects that use the same dependency are guaranteed to use the same version.
Because Gradle is very flexible, there are various ways to ensure that dependencies are declared with the same version in different projects. But none of them are terribly intuitive, and there is no standard way.
This is a common problem with dependency management on every platform, and the standard solution is a lock file ('paket.lock'), which saves the result of the dependency resolution to be used in future builds.
For years Gradle had no built-in support for lock files, although there was a Nebula plugin from Netflix that added locking capability. Recently Gradle has added built-in support for lock files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With