Improve Snapshot dynamic parts extraction
🔥 Problem
For the fix of #325749 (closed), we had to build a way to extract the dynamic part that Maven Repository clients put on file names.
Example: my-package-11.0-20230315.073119-2.pom
, 20230315.073119
is the dynamic part. It changes each time that $ mvn deploy
runs.
To detect that part, we used a regex. That one will match the very last match.
The problem is that users can use classifiers to generate additional artifacts. They can use any string for the classifier part.
Example: my-package-11.0-20230315.073119-2-fancy-classifier.jar
, 20230315.073119
is the dynamic part and fancy-classifier
is the classifier.
The regex will not work if the classifier follows the same structure as the dynamic part. For example, my-package-11.0-20230315.073119-2-55555555.444444-3.jar
, here the backend will wrongly extract 55555555.444444-3
as the classifier.
🚒 Solution
Improve the classifier extraction:
- Remove the package name and version from the file name and match the first group with the regex.