Skip to content

Commit a9c488c

Browse files
committed
fix(java-cloud-bom): resolve snapshots during linkage checks and skip reachability checks for SNAPSHOTs
1 parent 61b2409 commit a9c488c

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

java-cloud-bom/tests/src/test/java/com/google/cloud/BomContentTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ private void checkBom(Path bomPath) throws Exception {
7373
Bom bom = Bom.readBom(bomPath);
7474
List<Artifact> artifacts = bom.getManagedDependencies();
7575
for (Artifact artifact : artifacts) {
76+
if (artifact.getVersion().contains("SNAPSHOT")) {
77+
continue;
78+
}
7679
assertReachable(buildMavenCentralUrl(artifact));
7780
}
7881

@@ -98,6 +101,9 @@ static void checkBomReachable(Path bomPath) throws Exception {
98101

99102
StringBuilder errors = new StringBuilder();
100103
for (Artifact artifact : artifacts) {
104+
if (artifact.getVersion().contains("SNAPSHOT")) {
105+
continue;
106+
}
101107
try {
102108
assertReachable(buildMavenCentralUrl(artifact));
103109
} catch (IOException ex) {

java-cloud-bom/tests/src/test/java/com/google/cloud/MaximumLinkageErrorsTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.google.cloud.tools.opensource.classpath.LinkageChecker;
2424
import com.google.cloud.tools.opensource.classpath.LinkageProblem;
2525
import com.google.cloud.tools.opensource.dependencies.Bom;
26+
import com.google.cloud.tools.opensource.dependencies.DependencyGraphBuilder;
2627
import com.google.cloud.tools.opensource.dependencies.MavenRepositoryException;
2728
import com.google.cloud.tools.opensource.dependencies.RepositoryUtility;
2829
import com.google.cloud.tools.opensource.dependencies.UnresolvableArtifactProblem;
@@ -82,7 +83,12 @@ public void testForNewLinkageErrors()
8283
private LinkageChecker createLinkageChecker(Bom bom)
8384
throws InvalidVersionSpecificationException, IOException {
8485
ImmutableList<Artifact> managedDependencies = bom.getManagedDependencies();
85-
ClassPathBuilder classPathBuilder = new ClassPathBuilder();
86+
DependencyGraphBuilder graphBuilder =
87+
new DependencyGraphBuilder(
88+
ImmutableList.of(
89+
"https://repo1.maven.org/maven2/",
90+
"https://google.oss.sonatype.org/content/repositories/snapshots/"));
91+
ClassPathBuilder classPathBuilder = new ClassPathBuilder(graphBuilder);
8692

8793
// full: false to avoid fetching optional dependencies.
8894
ClassPathResult classPathResult =

0 commit comments

Comments
 (0)