Skip to content

Commit

Permalink
Repository id should default to inded + host if not set
Browse files Browse the repository at this point in the history
  • Loading branch information
denisrosca committed Jul 27, 2023
1 parent 1b189b9 commit 0298fca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import java.util.Collections;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.containsString;
import static org.mockserver.integration.ClientAndServer.startClientAndServer;

public class MavenResolverMultipleReposTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
"repositories": [
{
// Use HTTP instead of HTTPS because we're running a mock server during tests
"id": "Artifactory 1",
"url": "http://localhost:1234/artifactory-1"
},
{
// Use HTTP instead of HTTPS because we're running a mock server during tests
"id": "Artifactory 2",
"url": "http://localhost:1234/artifactory-2"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ public void serviceCreationFailed(Class<?> type, Class<?> impl, Throwable except
public void addRepository(MavenRepository repository) {
try {
URI uri = new URI(repository.getUrl());
String id = repository.getId().orElseGet(() -> uri.getHost());
int repoIndex = remoteRepositories.size() + 1;
String id = repository.getId().orElseGet(() -> repoIndex + "|" + uri.getHost());
String userInfo = uri.getUserInfo();
RemoteRepository.Builder builder = new RemoteRepository.Builder(id, "default", repository.getUrl());
if (userInfo != null) {
Expand Down

0 comments on commit 0298fca

Please sign in to comment.