This message was deleted.
# dependency-management
s
This message was deleted.
m
A
force
is a hammer, which is also purely local to the project being resolved. It will ignore anything else and is somehow subject to ordering issues. A
strictly
is a proper dependency version declaration, which is used during resolution as any other information. For example it will participate in conflict resolution and fail if it finds conflicting
strictly
clauses. Also it's published, which means that consumers will get the strictly.
In other words,
strictly
is a better designed solution for
force
.
t
this is in the context of an app, so I'm not concerned about publishing the information. Is there any performance impact? Right now we have a base plugin that's applied to every subproject in our project, so they all get the force rule. Would it make any measurable difference to replace that with a strictly constraint?
m
I suspect a
force
would be faster, but no numbers to back that statement.
t
thanks 👍
although I'm wondering if this is on the order of milliseconds or microseconds or something. I know that AGP applies constraints from the runtime classpath to the compile classpath already, so our build is chock full of constraints due to that
x
Gradle should really remove the
force
option. Every time I've asked I've been told not to use it
💯 2
t
I'm not seeing a good reason why tbh. Saying that constraints are "better designed" is nice, but not really compelling from an end-user perspective
☝️ 1
it's like how the docs say you shouldn't use
getPlugins()
but instead
getPluginManager()
without any explanation why the latter should be preferred
3
m
I'm sorry I thought I was clear:
force
is a hammer which is inherently broken. Depending on when the force is seen first (when it's on a dependency), you get different results. When it's on a configuration, it doesn't propagate to consumers, which is, IMO, another reason to avoid it. So, prefer
strictly
. This is the only mechanism which is consistent and would give you better error messages in case of conflicts.
t
I hear you. Since we apply the force rules universally, I don't think we have the problem of consumers not seeing it. I agree that we should migrate. This is about prioritizing work and also fully understanding the space for the inevitable questions when I do make this change
j
Isn’t force deprecated to indicate at least that is is to be fully replaced by strictly?
m
force
is deprecated on an
ExternalDependency
, but not on a
ResolutionStrategy
.
👍 1