Fix trailing dash in DEFAULT_FILE_NAME_MAPPING_CLASSIFIER when classifier is null or empty - #70
Merged
Merged
Conversation
…fier is null
DEFAULT_FILE_NAME_MAPPING_CLASSIFIER used '-@\{classifier\}@' which
produced a trailing dash (e.g. 'artifact-1.0-.jar') when the classifier
was null, because the literal dash remained after the empty classifier
substitution.
Change the pattern to use '@\{dashClassifier?\}@' which already handles
null classifiers correctly by expanding to empty string without a dash.
Also added a test that exposes this bug and updated the existing
mappingWithNullClassifier test to expect the correct output.
Closes #65
elharo
marked this pull request as draft
August 19, 2026 19:31
elharo
marked this pull request as ready for review
August 20, 2026 12:18
adangel
approved these changes
Aug 20, 2026
|
@elharo Please assign appropriate label to PR according to the type of change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DEFAULT_FILE_NAME_MAPPING_CLASSIFIERuses the pattern@{artifactId}@-@{baseVersion}@-@{classifier}@.@{extension}@. When the artifact's classifier is null,DashClassifierValueSourcesets theclassifierproperty to empty string"". The literal-before@{classifier}@remains, producing a trailing dash in the output:Fix
Change
DEFAULT_FILE_NAME_MAPPING_CLASSIFIERto use@{dashClassifier?}@instead of-@{classifier}@:The
@{dashClassifier?}@expression already handles null correctly -- it expands to-classifierwhen present, or empty string when absent, with no trailing dash.Test
Added
mappingWithNullClassifierShouldNotHaveTrailingDashwhich asserts the correct outputmaven-test-lib-1.0.jar(no trailing dash). This test fails without the fix.All 7 tests pass after the fix.
Closes #65