Open rtyley opened 11 months ago
Thank you @rtyley for the investigation and detailed report!
As you have noticed, what happens is that Mima compares the project classfiles (without the project's dependencies folded in) with the über-jar.
Conceptually, I think it's possible that any über jar submodule is unlikely to ever suffer from the versioning issues that
sbt-version-policy
is designed to protect against - über jars are used as CLI tools, or AWS Lambdas - standalone programs.
Yes, I agree with that. If play-secret-rotation
is not “consumed” as a library, the versioning scheme implemented by sbt-version-policy is irrelevant, and it should be skipped.
That being said, it is probably possible to configure Mima to work correctly by customizing the setting mimaCurrentClassfiles
in the project play-secret-rotation
.
To be honest, I believe the solutions to handle this situation should be documented in Mima itself. I see that a discussion was opened, but it does not contain a conclusion: https://github.com/lightbend/mima/discussions/709.
I noticed that
versionPolicyAssessCompatibility
(added in PR https://github.com/scalacenter/sbt-version-policy/pull/184) always reportsNone
compatibility for theaws-parameterstore-lambda
submodule in the projectplay-secret-rotation
(configured forsbt-version-policy
with https://github.com/guardian/play-secret-rotation/pull/416), while all other modules areBinaryAndSourceCompatible
(in fact even when there have been no code or dependency changes to the project at all since the last release).This module is the only one in the
play-secret-rotation
project that's ansbt-assembly
über jar with all of its dependencies (configured in its submodule build.sbt - because it's used in an AWS Lambda, where having a single jar makes for easier deployment).Running
aws-parameterstore-lambda / versionPolicyCheck
shows no 'dependency' issues, it'sversionPolicyMimaCheck
that fails, with hundreds ofMissingClassProblem
s, one for each class from the dependencies that are later folded into the dependency bysbt-assembly
:Conceptually, I think it's possible that any über jar submodule is unlikely to ever suffer from the versioning issues that
sbt-version-policy
is designed to protect against - über jars are used as CLI tools, or AWS Lambdas - standalone programs. In theplay-secret-rotation
project I'm only publishingaws-parameterstore-lambda
as a Maven artifact as it's a convenient place to publish to, for the purpose of distribution.Workaround
I think a reasonable route is to set
versionPolicyAssessCompatibility / skip := true
in the submodule (as in https://github.com/guardian/play-secret-rotation/pull/420), but it did take a bit of digging to work out what the problem was and fix it - I'm creating this issue to partly record my findings, and to think about a better developer experience for developers usingsbt-version-policy
.cc @julienrf