[java-storage-nio]: transitive google-cloud-storage dependency causes scope conflicts when used at test scope
Maintainer antworten meist innerhalb von 1 Tag
@Dhriti07 arbeitet bereits daran.
Seit 25.8.2026.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
Problem
google-cloud-nio is commonly used at test scope to provide a java.nio.file.FileSystemProvider for gs:// URIs in tests. However, it depends on google-cloud-storage at compile scope, which pulls in ~15 transitive dependencies.
When a project already has google-cloud-storage at compile scope (e.g. via spring-cloud-gcp-starter-storage), adding google-cloud-nio at test scope can cause Maven's "nearest definition wins" rule to silently re-resolve google-cloud-storage and its transitives at test scope. Build tools that strip test-scoped jars from the runtime image (e.g. Jib) then produce containers with missing classes, causing ClassNotFoundException at startup.
The current workaround is to manually exclude google-cloud-storage from google-cloud-nio:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-nio</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
</exclusion>
</exclusions>
</dependency>
This is fragile and non-obvious. Every consumer hitting this has to independently discover the problem and apply the same fix.
Suggestion
One of:
-
Separate artifact: publish a
google-cloud-nio-testingartifact that contains only theFileSystemProviderregistration and declaresgoogle-cloud-storageasprovidedoroptional. This matches the pattern used by other GCP libraries (e.g.google-cloud-bigtable-emulator-core). -
Mark
google-cloud-storageasoptional: in the existinggoogle-cloud-nioPOM, declaregoogle-cloud-storageas<optional>true</optional>. Consumers already have it on the classpath at compile scope via their GCS integration. This avoids the transitive scope conflict without a new artifact.
- Vorherrschende Sprache
- Java
- Sterne
- 2.1k
- Forks
- 1.2k
- Ø Merge
- 2 T. 14 Std.
- Gemergte PRs (30 T.)
- 192
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus googleapis/google-cloud-java
-
[java-core] Timestamp.of(java.sql.Timestamp) is one second late for a time less than a second before the epochEvtl. vergeben @Vcode2407 hat das vor 4 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
googleapis/google-cloud-java#14636 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[java-firestore] UserDataConverter encodes a pre-epoch Date with negative nanos, so the write is refusedEvtl. vergeben @wu-hui hat das vor 23 Tagen übernommen. Offenpriority: p2 type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
googleapis/google-cloud-java#14635 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
[java-firestore] UserDataConverter throws IndexOutOfBoundsException on an empty __binary__ valueEvtl. vergeben @wu-hui hat das vor 23 Tagen übernommen. Offenpriority: p2 type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
googleapis/google-cloud-java#14634 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
[java-firestore] CustomClassMapper.convertBigDecimal calls .abs() on Double, unintentionally flipping negative values to positiveEvtl. wieder frei @wu-hui hat das vor 45 Tagen übernommen, und es ist kein Pull Request offen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
googleapis/google-cloud-java#14533 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Github CI failing when trying to install xmllintEvtl. vergeben @blakeli0 hat das vor 81 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
googleapis/google-cloud-java#14132 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in googleapis/google-cloud-java
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
finos/fluxnova-bpm-platform#387 ·
Maintainer antworten meist innerhalb von 4 Tagen
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
-
Schwierigkeit 2/5 Unter einer Stunde Anfängerfreundlichkeit 84/100
cpp-best-practices/project_validator#251 ·
Maintainer antworten meist innerhalb von 1 Tag
-
backend enhancement
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 70/100
damodharg6/payledger#16 ·
-
[Bug]: An initiative list with no current entry logs an error on every changeEvtl. vergeben @dwizard0 hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Maintainer antworten meist innerhalb von 1 Tag