Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-9444

Shall we use GCP Libraries BOM to specify Google-related library versions?

Details

    • Task
    • Status: Resolved
    • P3
    • Resolution: Fixed
    • None
    • 2.26.0
    • build-system
    • None

    Description

      Shall we use GCP Libraries BOM to specify Google-related library versions?
       
      I've been working on Beam's dependency upgrades in the past few months. I think it's time to consider a long-term solution to keep the libraries up-to-date with small maintenance effort. To achieve that, I propose Beam to use GCP Libraries BOM to set the Google-related library versions, rather than trying to make changes in each of ~30 Google libraries.
       

      Background

      A BOM is pom.xml that provides dependencyManagement to importing projects.
       
      GCP Libraries BOM is a BOM that includes many Google Cloud related libraries + gRPC + protobuf. We (Google Cloud Java Diamond Dependency team) maintain the BOM so that the set of the libraries are compatible with each other.
       

      Implementation

      Notes for obstacles.

      BeamModulePlugin's "force" does not take BOM into account (thus fails)

      forcedModules via version resolution strategy is playing bad. This causes

      A problem occurred evaluating project ':sdks:java:extensions:sql'. 
      Could not resolve all dependencies for configuration ':sdks:java:extensions:sql:fmppTemplates'.
      Invalid format: 'com.google.cloud:google-cloud-core'. Group, name and version cannot be empty. Correct example: 'org.gradle:gradle-core:1.0'


       

      :sdks:java:maven-archetypes:examples needs the version of google-http-client

      The task requires the version for the library:

          'google-http-client.version': dependencies.create(project.library.java.google_http_client).getVersion(),
      

      This would generate NullPointerException. Running gradlew without the subproject:
       

      ./gradlew -p sdks/java check -x :sdks:java:maven-archetypes:examples:check
      

      Problem in Gradle-generated pom files

      The generated Maven artifact POM has invalid data due to the BOM change. For example my locally installed ~/.m2/repository/org/apache/beam/beam-sdks-java-io-google-cloud-platform/2.21.0-SNAPSHOT/beam-sdks-java-io-google-cloud-platform-2.21.0-SNAPSHOT.pom had the following problems.

      The GCP Libraries BOM showing up in dependencies section:

        <dependencies>
          <dependency>
            <groupId>com.google.cloud</groupId>
            <artifactId>libraries-bom</artifactId>
            <version>4.2.0</version>
            <scope>compile</scope>
            <exclusions>
              <exclusion>
                <groupId>com.google.guava</groupId>
                <artifactId>guava-jdk5</artifactId>
              </exclusion>...
            </exclusions>
          </dependency>
      

      The artifact that use the BOM in Gradle is missing version in the dependency.

          <dependency>
            <groupId>com.google.api</groupId>
            <artifactId>gax</artifactId>
            <version/>
            <scope>compile</scope>
            ...
          </dependency>
      

      DependencyManagement section in generated pom.xml

      How can I check whether a entry in dependencies is "platform"?

      Attachments

        1. Screen Shot 2020-03-13 at 13.33.01.png
          824 kB
          Tomo Suzuki
        2. Screen Shot 2020-03-17 at 16.01.16.png
          772 kB
          Tomo Suzuki

        Activity

          People

            kileys Kiley Sok
            suztomo Tomo Suzuki
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20.5h
                20.5h