elharo opened a new pull request, #70:
URL: https://github.com/apache/maven-mapping/pull/70
## Problem
`DEFAULT_FILE_NAME_MAPPING_CLASSIFIER` uses the pattern
`@{artifactId}@-@{baseVersion}@-@{classifier}@.@{extension}@`. When the
artifact's classifier is null, `DashClassifierValueSource` sets the
`classifier` property to empty string `""`. The literal `-` before
`@{classifier}@` remains, producing a trailing dash in the output:
```
maven-test-lib-1.0-.jar
^ trailing dash
```
## Fix
Change `DEFAULT_FILE_NAME_MAPPING_CLASSIFIER` to use `@{dashClassifier?}@`
instead of `-@{classifier}@`:
```
@{artifactId}@-@{baseVersion}@@{dashClassifier?}@.@{extension}@
```
The `@{dashClassifier?}@` expression already handles null correctly -- it
expands to `-classifier` when present, or empty string when absent, with no
trailing dash.
## Test
Added `mappingWithNullClassifierShouldNotHaveTrailingDash` which asserts the
correct output `maven-test-lib-1.0.jar` (no trailing dash). This test fails
without the fix.
All 7 tests pass after the fix.
Closes #65
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]