Skip to content

Commit a42c139

Browse files
committed
chore: add comments explaining local cache reachability bypass
1 parent 72fa709 commit a42c139

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ private void checkBom(Path bomPath) throws Exception {
7777
if (artifact.getVersion().contains("SNAPSHOT")) {
7878
continue;
7979
}
80+
// If the artifact is built locally (e.g. during a release PR), it will be in the local
81+
// .m2 cache. We can skip checking Maven Central for these local artifacts since they
82+
// are not yet published.
8083
if (existsLocally(artifact)) {
8184
continue;
8285
}
@@ -108,6 +111,9 @@ static void checkBomReachable(Path bomPath) throws Exception {
108111
if (artifact.getVersion().contains("SNAPSHOT")) {
109112
continue;
110113
}
114+
// If the artifact is built locally (e.g. during a release PR), it will be in the local
115+
// .m2 cache. We can skip checking Maven Central for these local artifacts since they
116+
// are not yet published.
111117
if (existsLocally(artifact)) {
112118
continue;
113119
}
@@ -141,9 +147,15 @@ private static String buildMavenCentralUrl(Artifact artifact) {
141147
+ ".pom";
142148
}
143149

150+
/**
151+
* Checks if the artifact exists in the local Maven repository cache.
152+
* This is used as a fallback/bypass for reachability checks during release PRs.
153+
*/
144154
private static boolean existsLocally(Artifact artifact) {
145155
String localRepository = System.getProperty("maven.repo.local");
146156
if (localRepository == null) {
157+
// Standard default location for Maven local repository.
158+
// GHA runners also use this path by default (cached by actions/setup-java).
147159
localRepository = System.getProperty("user.home") + "/.m2/repository";
148160
}
149161
Path localPath = Paths.get(localRepository,

0 commit comments

Comments
 (0)