Skip to content

[not for merge] Trying the Libraries BOM with the shared dependencies BOM content#2162

Closed
suztomo wants to merge 5 commits intomasterfrom
try_shared_dependencies_bom
Closed

[not for merge] Trying the Libraries BOM with the shared dependencies BOM content#2162
suztomo wants to merge 5 commits intomasterfrom
try_shared_dependencies_bom

Conversation

@suztomo
Copy link
Copy Markdown
Contributor

@suztomo suztomo commented Jul 30, 2021

This PR is not going to be merged.

Trying replacing the shared dependencies BOM content to see any failures.

@google-cla google-cla bot added the cla: yes label Jul 30, 2021
@suztomo suztomo changed the title Trying replacing the shared dependencies BOM content Trying the Libraries BOM with the shared dependencies BOM content Jul 30, 2021
@suztomo
Copy link
Copy Markdown
Contributor Author

suztomo commented Jul 30, 2021

google-oauth-client-bom includes google-oauth-client-assembly, which depends on google-play-services:google-play-services. This artifact requires a special installation.

[INFO] Running com.google.cloud.MaximumLinkageErrorsTest
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Jul 30, 2021 4:41:35 PM com.google.cloud.tools.opensource.classpath.LinkageChecker create
SEVERE: com.google.android.google-play-services:google-play-services:jar:1 was not resolved. Dependency path: null > com.google.api-client:google-api-client-android:jar:1.32.1 (compile) > com.google.android.google-play-services:google-play-services:jar:1 (provided)
Jul 30, 2021 4:41:35 PM com.google.cloud.tools.opensource.classpath.LinkageChecker create
SEVERE: com.google.oauth-client:google-oauth-client-assembly:jar:1.31.5 was not resolved. Dependency path: null > com.google.oauth-client:google-oauth-client-assembly:jar:1.31.5 (compile)
Error:  Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 96.174 s <<< FAILURE! - in com.google.cloud.MaximumLinkageErrorsTest
Error:  testForNewLinkageErrors(com.google.cloud.MaximumLinkageErrorsTest)  Time elapsed: 96.132 s  <<< ERROR!
java.io.IOException: Could not resolve 2 dependencies. See the message above for details.
	at com.google.cloud.MaximumLinkageErrorsTest.testForNewLinkageErrors(MaximumLinkageErrorsTest.java:52)

@suztomo
Copy link
Copy Markdown
Contributor Author

suztomo commented Jul 30, 2021

Same error on google-api-client-android

SEVERE: com.google.android.google-play-services:google-play-services:jar:1 was not resolved. Dependency path: null > com.google.api-client:google-api-client-android:jar:1.32.1 (compile) > com.google.android.google-play-services:google-play-services:jar:1 (provided)
Jul 30, 2021 4:41:35 PM com.google.cloud.tools.opensource.classpath.LinkageChecker create
SEVERE: com.google.oauth-client:google-oauth-client-assembly:jar:1.31.5 was not resolved. Dependency path: null > com.google.oauth-client:google-oauth-client-assembly:jar:1.31.5 (compile)

@suztomo
Copy link
Copy Markdown
Contributor Author

suztomo commented Jul 30, 2021

google-api-client-assembly

SEVERE: com.google.android.google-play-services:google-play-services:jar:1 was not resolved. Dependency path: null > com.google.api-client:google-api-client-assembly:pom:1.32.1 (compile) > com.google.api-client:google-api-client-android:jar:1.32.1 (compile) > com.google.android.google-play-services:google-play-services:jar:1 (provided)

@elharo
Copy link
Copy Markdown
Contributor

elharo commented Jul 30, 2021

I've hit that play services issue before, though not, so far as I recall, in oauth-client. It's worth trying to rip that out at the root. We really shouldn't need it. We also might not need assemblies any more.

@suztomo
Copy link
Copy Markdown
Contributor Author

suztomo commented Jul 30, 2021

@elharo Thanks. I agree. I'll try to get rid of these artifacts from their BOMs after checking whether they are unused or not.

Comment on lines +261 to +263
<artifactId>google-cloud-core</artifactId>
<version>${google.core.version}</version>
<type>test-jar</type>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linkage Checker is not handling the google-cloud-core artifact that appears multiple times with different classifiers.

The error is shown as if google-cloud-core is missing.

Error:  testForNewLinkageErrors(com.google.cloud.MaximumLinkageErrorsTest)  Time elapsed: 161.994 s  <<< FAILURE!
java.lang.AssertionError: 
Baseline BOM: com.google.cloud:libraries-bom:20.9.0
Newly introduced problems:
Class com.google.cloud.ServiceOptions is not found;
  referenced by 24 class files
    com.google.cloud.ServiceOptionsTest (com.google.cloud:google-cloud-core:1.95.4)
    com.google.cloud.BaseWriteChannelTest (com.google.cloud:google-cloud-core:1.95.4)
    com.google.cloud.SerializationTest (com.google.cloud:google-cloud-core:1.95.4)
    com.google.cloud.bigquery.BigQueryOptions (com.google.cloud:google-cloud-bigquery:1.137.1)

Copy link
Copy Markdown
Contributor Author

@suztomo suztomo Jul 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependency management includes type and classifier.

pom.xml:

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.example</groupId>
  <artifactId>maven-dependency-management-classifier</artifactId>
  <version>1.0-SNAPSHOT</version>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-core</artifactId>
        <version>1.96.0</version><!-- {x-version-update:google-cloud-core:current} -->
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>google-cloud-core</artifactId>
      <type>test-jar</type>
    </dependency>
    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>google-cloud-core</artifactId>
      <classifier>tests</classifier>
    </dependency>
  </dependencies>
</project>

The build fails:

suztomo@suztomo-macbookpro44 maven-dependency-management-classifier % mvn dependency:tree
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] 'dependencies.dependency.version' for com.google.cloud:google-cloud-core:test-jar is missing. @ line 28, column 17
[ERROR] 'dependencies.dependency.version' for com.google.cloud:google-cloud-core:jar:tests is missing. @ line 33, column 17
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project org.example:maven-dependency-management-classifier:1.0-SNAPSHOT (/Users/suztomo/maven-dependency-management-classifier/pom.xml) has 2 errors
[ERROR]     'dependencies.dependency.version' for com.google.cloud:google-cloud-core:test-jar is missing. @ line 28, column 17
[ERROR]     'dependencies.dependency.version' for com.google.cloud:google-cloud-core:jar:tests is missing. @ line 33, column 17
[ERROR] 

Copy link
Copy Markdown
Contributor Author

@suztomo suztomo Jul 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly, the two Maven coordinates (com.google.cloud:google-cloud-core:tests and com.google.cloud:google-cloud-core:test-jar:tests) refer to the same JAR file.

Screen Shot 2021-07-30 at 16 07 44

Screen Shot 2021-07-30 at 16 08 35

The code change at the former: https://github.com/googleapis/java-shared-dependencies/pull/59/files#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R246

The code change at the latter: https://github.com/googleapis/java-shared-dependencies/pull/40/files#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R286

As per documentation (http://maven.apache.org/guides/mini/guide-attached-tests.html), test-jar type and the tests classifier should be specified.

@suztomo suztomo changed the title Trying the Libraries BOM with the shared dependencies BOM content [not for merge] Trying the Libraries BOM with the shared dependencies BOM content Jul 30, 2021
@suztomo
Copy link
Copy Markdown
Contributor Author

suztomo commented Aug 12, 2021

The classifier fix remediated the problem around Class com.google.cloud.ServiceOptions is not found.

Still there are linkage errors on the test related dependencies, as expected.

Error:  testForNewLinkageErrors(com.google.cloud.MaximumLinkageErrorsTest)  Time elapsed: 208.565 s  <<< FAILURE!
java.lang.AssertionError: 
Baseline BOM: com.google.cloud:libraries-bom:20.9.0
Newly introduced problems:
Class org.easymock.EasyMock is not found;
  referenced by 3 class files
    com.google.cloud.BatchResultTest (com.google.cloud:google-cloud-core:jar:tests:1.95.4)
    com.google.cloud.testing.BaseEmulatorHelperTest (com.google.cloud:google-cloud-core:jar:tests:1.95.4)
    com.google.cloud.BaseServiceExceptionTest (com.google.cloud:google-cloud-core:jar:tests:1.95.4)
Class org.easymock.IExpectationSetters is not found;
  referenced by 2 class files
    com.google.cloud.testing.BaseEmulatorHelperTest (com.google.cloud:google-cloud-core:jar:tests:1.95.4)
    com.google.cloud.BaseServiceExceptionTest (com.google.cloud:google-cloud-core:jar:tests:1.95.4)
Class com.google.apphosting.base.protos.api.ApiBasePb$StringProto is not found;
  referenced by 1 class file
    com.google.appengine.api.datastore.AsyncDatastoreServiceImpl (com.google.appengine:appengine-api-1.0-sdk:1.9.87)
Class com.google.apphosting.base.protos.api.ApiBasePb$StringProto$Builder is not found;
  referenced by 1 class file
    com.google.appengine.api.datastore.AsyncDatastoreServiceImpl (com.google.appengine:appengine-api-1.0-sdk:1.9.87)
Class com.google.apphosting.base.protos.api.ApiBasePb is not found;
  referenced by 1 class file
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes kokoro:run force run kokoro

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants