Upgrade to spring javaformat 0.0.38

This commit is contained in:
Stephane Nicoll
2023-04-03 14:57:51 +02:00
parent 32b5db7a5a
commit 5e97a01e99
207 changed files with 2449 additions and 1746 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,13 +54,16 @@ import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
class MavenResolverDependencyManagementVersionResolver implements DependencyManagementVersionResolver {
private static final RemoteRepository mavenCentral = new RemoteRepository.Builder("central", "default",
"https://repo1.maven.org/maven2").build();
"https://repo1.maven.org/maven2")
.build();
private static final RemoteRepository springMilestones = new RemoteRepository.Builder("spring-milestones",
"default", "https://repo.spring.io/milestone").build();
"default", "https://repo.spring.io/milestone")
.build();
private static final RemoteRepository springSnapshots = new RemoteRepository.Builder("spring-snapshots", "default",
"https://repo.spring.io/snapshot").build();
"https://repo.spring.io/snapshot")
.build();
private static final List<RemoteRepository> repositories = Arrays.asList(mavenCentral, springMilestones,
springSnapshots);
@@ -86,8 +89,11 @@ class MavenResolverDependencyManagementVersionResolver implements DependencyMana
public Map<String, String> resolve(String groupId, String artifactId, String version) {
ArtifactDescriptorResult bom = resolveBom(groupId, artifactId, version);
Map<String, String> managedVersions = new HashMap<>();
bom.getManagedDependencies().stream().map(Dependency::getArtifact).forEach((artifact) -> managedVersions
.putIfAbsent(artifact.getGroupId() + ":" + artifact.getArtifactId(), artifact.getVersion()));
bom.getManagedDependencies()
.stream()
.map(Dependency::getArtifact)
.forEach((artifact) -> managedVersions.putIfAbsent(artifact.getGroupId() + ":" + artifact.getArtifactId(),
artifact.getVersion()));
return managedVersions;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -71,8 +71,8 @@ class MavenResolverDependencyManagementVersionResolverTests {
@Test
void nonExistentDependency() {
assertThatIllegalStateException()
.isThrownBy(() -> this.resolver.resolve("org.springframework.boot", "spring-boot-bom", "1.0"))
.withMessage("Bom 'org.springframework.boot:spring-boot-bom:1.0' could not be resolved");
.isThrownBy(() -> this.resolver.resolve("org.springframework.boot", "spring-boot-bom", "1.0"))
.withMessage("Bom 'org.springframework.boot:spring-boot-bom:1.0' could not be resolved");
}
}