Add version prefixes option to released-version goal#159
Conversation
Allow running the released-version goal with optional parameter versionPrefix, which filters the matched released versions to versions that begin with that prefix. For example, if the released versions are 1.3.1, 1.3.2, 1.4.1, 1.4.2, and you run `mvn build-helper:released-version` normally, it will find version 1.4.2 as the latest released version. This commit makes it so if you give it the parameter versionPrefix=1.3, then it will find 1.3.2 instead. You can also pass in the versionPrefix via a property: mvn build-helper:released-version -DreleasedVersion.versionPrefix=1.3
|
Fix for #154 |
|
While this fixes your goal, I wonder: Why not use maven version ranges? They are already production-proven and could do the same. E.g. |
|
That is a good idea. I did think that "prefixes" was an awkward way of defining things. My only concern with version ranges is that it's moderately inconvenient for command line, since those are special characters that need escaping or quoting. Any thoughts about that? Regardless, I think it's still superior. I will update the PR. |
|
Actually, having implemented this, I am finding the In my use case, I have a situation where my current deployed version is some version such as 1.3.2. I would like to upgrade to the latest incremental version, but I don't want to change minor (or major) versions. Therefore, if 1.3.5 and 1.4.3 are both released versions, I want to find 1.3.5. If the API uses version ranges, then I need to give it Just stripping the incremental version and giving it Though, now that I think about it more, maybe the best API would be:
@bmarwell what do you think? I'm imagining we adopt Though... this requires depending on the versions plugin, or at least |
Allow running the released-version goal with optional parameter versionPrefix, which filters the matched released versions to versions that begin with that prefix.
For example, if the released versions are 1.3.1, 1.3.2, 1.4.1, 1.4.2, and you run
mvn build-helper:released-versionnormally, it will find version 1.4.2 as the latest released version.This commit makes it so if you give it the parameter versionPrefix=1.3, then it will find 1.3.2 instead.
You can also pass in the versionPrefix via a property:
mvn build-helper:released-version -DreleasedVersion.versionPrefix=1.3