Open lukecwik opened 4 years ago
FYI, Google-cloud-java team has https://github.com/googleapis/google-cloud-java/blob/master/TROUBLESHOOTING.md#classnotfoundexception-nosuchmethoderror-noclassdeffounderror
If you can't modify and push new versions of your dependencies, import com.google.cloud:libraries-bom:3.4.0 (or a more recent version) and use that to select consistent dependency versions.
Yet, we observed cases where libraries-bom cannot solve NoClassDefFoundErrors or NoSuchMethodErrors with Apache Beam. That's why I'm contributing to the dependency upgrades.
Memo: Understand problem:
Fix?
Let the GCP Libraries BOM specify the versions of your dependencies for Maven artifacts listed in https://storage.googleapis.com/cloud-opensource-java-dashboard/com.google.cloud/libraries-bom/snapshot/artifact_details.html (replace "snapshot" with your BOM version, such as 4.0.1).
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>4.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
dependencies {
api platform('com.google.cloud:libraries-bom:4.0.1')
}
For more details, refer to Gradle: The Java Platform Plugin.
Use the version in "Recommended Versions" section of Google Cloud Platform Java Dependency Dashboard (replace the "snapshot" in the URL with your GCP Libraries BOM versoin).
For libraries still not listed in the previous section, use https://search.maven.org/ to find the latest version of library.
Some Google libraries have version number that consists of several components. For example,com.google.apis:google-api-services-iam
's versions include "v1-rev20200131-1.30.8", "v1-rev20191213-1.29.2", "v1-rev20191213-1.28.0". This version scheme consists of 3 components separated by dashes: server-side API version, release date, and Google API client version.
In the example of "v1-rev20200131-1.30.8",
When you encounter such versions, select the version with "1.30.X' in Google API client version and the latest release date. There should be one server-side API versions after this criteria.
It would be great if there was a runbook which we could point users of Apache Beam and also Google Cloud customers when resolving linkage errors between their project and Apache Beam/Google Cloud libraries.