Better way to simply force a dependency
I am surprised that there is no rule type to simply force a specific version of a transitive dependency. I know I can achieve this with:
substitute": [
{
"module" : "org.myorg.group:myartifact",
"with" : "org.myorg.group:myartifact:2.1.2",
"reason" : "blabla",
"author" : "me",
"date" : "2019-06-14"
},
]
but, it looks a bit not straight forward, why do I have to specify the GAV coordinate twice when I simply want to force 2.1.2 there?
Also, I would like to propose another feature. In align rules you have the attribute "includes" which allow formats like:
"includes": ["springfox-(bean-validators|core|schema|spi|spring-web|swagger-common|swagger-ui|swagger2|)"],
why don't you support the same syntax in more attributes, like the previous "substitute", so you can have something like:
substitute": [
{
"module" : "org.myorg.group:(myartifact|myartifact2|myartifact3)",
"with" : "org.myorg.group:(myartifact|myartifact2|myartifact3):2.1.2",
"reason" : "blabla",
"author" : "me",
"date" : "2019-06-14"
},
]
Hi @rupebac thank you for the feedback. The reason why alignment rules support includes is that they are conceptually slightly different. One alignment rule is expected to operate on a group of dependencies. The proposal for substitution is just a convenience for easier declaration of multiple rules affecting independent dependencies. You can add all substitution rules into a single file like:
substitute": [
{
"module" : "org.myorg.group:myartifact",
...
},
{
"module" : "org.myorg.group:myartifact2",
...
}
]
We don't have a big burden with such notation. That said we are not going to implement any time soon. If you are willing to contribute we are open to PRs.