Merge branch '2.3.x'
Closes gh-23541
This commit is contained in:
@@ -144,7 +144,7 @@ public class ArtifactsLibraries implements Libraries {
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return this.artifact.getVersion();
|
||||
return this.artifact.getBaseVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.boot.maven;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -130,4 +131,20 @@ class ArtifactsLibrariesTests {
|
||||
assertThat(this.libraryCaptor.getAllValues().get(1).getName()).isEqualTo("g2-artifact-1.0.jar");
|
||||
}
|
||||
|
||||
@Test
|
||||
void libraryCoordinatesVersionUsesBaseVersionOfArtifact() throws IOException {
|
||||
Artifact snapshotArtifact = mock(Artifact.class);
|
||||
given(snapshotArtifact.getType()).willReturn("jar");
|
||||
given(snapshotArtifact.getScope()).willReturn("compile");
|
||||
given(snapshotArtifact.getGroupId()).willReturn("g1");
|
||||
given(snapshotArtifact.getArtifactId()).willReturn("artifact");
|
||||
given(snapshotArtifact.getVersion()).willReturn("1.0-20200929.090327-28");
|
||||
given(snapshotArtifact.getBaseVersion()).willReturn("1.0-SNAPSHOT");
|
||||
given(snapshotArtifact.getFile()).willReturn(new File("a"));
|
||||
given(snapshotArtifact.getArtifactHandler()).willReturn(this.artifactHandler);
|
||||
this.artifacts = Collections.singleton(snapshotArtifact);
|
||||
new ArtifactsLibraries(this.artifacts, null, mock(Log.class)).doWithLibraries(
|
||||
(library) -> assertThat(library.getCoordinates().getVersion()).isEqualTo("1.0-SNAPSHOT"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user