Skip to content

Commit fc20d9c

Browse files
docs: promote use of bill of materials in quickstart documentation (#1620)
Fixes #1552
1 parent e51930f commit fc20d9c

File tree

1 file changed

+65
-8
lines changed

1 file changed

+65
-8
lines changed

README.md

Lines changed: 65 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,35 +50,92 @@ credentials as well as utility methods to create them and to get Application Def
5050

5151
## Quickstart
5252

53+
### Preferred method: using `java-libraries-bom`
54+
If your use case is to enable authentication for a GAPIC library such as `google-cloud-datastore`,
55+
you may want simply add `libraries-bom`, which automatically imports the auth bom, to your pom.xml
56+
as follows:
57+
58+
[//]: # ({x-version-update-start:google-auth-library-bom:released})
59+
```xml
60+
<dependencyManagement>
61+
<dependencies>
62+
<dependency>
63+
<groupId>com.google.cloud</groupId>
64+
<artifactId>libraries-bom</artifactId>
65+
<version>26.53.0</version>
66+
<type>pom</type>
67+
<scope>import</scope>
68+
</dependency>
69+
</dependencies>
70+
</dependencyManagement>
71+
```
72+
73+
Otherwise, if you don't plan using libraries-bom, see the next section on
74+
_Google Auth Library Bill of Materials_.
75+
76+
### Using Maven
77+
78+
#### Google Auth Library Bill of Materials
79+
In order to ensure transitive dependencies and the modules themselves are aligned with each other,
80+
we rely on the Google Auth Library Bill of Materials. Please add this to your dependency management
81+
section as follows:
82+
83+
[//]: # ({x-version-update-start:google-auth-library-bom:released})
84+
```xml
85+
<dependencyManagement>
86+
<dependencies>
87+
<dependency>
88+
<groupId>com.google.auth</groupId>
89+
<artifactId>google-auth-library-bom</artifactId>
90+
<version>1.30.1</version>
91+
<type>pom</type>
92+
<scope>import</scope>
93+
</dependency>
94+
</dependencies>
95+
</dependencyManagement>
96+
```
97+
[//]: # ({x-version-update-end})
98+
99+
#### Choosing your implementation
100+
53101
If you are using Maven, add this to your pom.xml file (notice that you can replace
54102
`google-auth-library-oauth2-http` with any of `google-auth-library-credentials` and
55103
`google-auth-library-appengine`, depending on your application needs):
56104

57-
[//]: # ({x-version-update-start:google-auth-library-oauth2-http:released})
58-
59105
```xml
60106
<dependency>
61107
<groupId>com.google.auth</groupId>
108+
<!-- Let the BOM manage the module and dependency versions -->
109+
<!-- Replace with the module(s) that are needed -->
62110
<artifactId>google-auth-library-oauth2-http</artifactId>
63-
<version>1.19.0</version>
64111
</dependency>
65112
```
66-
[//]: # ({x-version-update-end})
67-
68113

114+
### Using Gradle
69115
If you are using Gradle, add this to your dependencies
70116

71-
[//]: # ({x-version-update-start:google-auth-library-oauth2-http:released})
117+
[//]: # ({x-version-update-start:google-auth-library-bom:released})
72118
```Groovy
73-
implementation 'com.google.auth:google-auth-library-oauth2-http:1.19.0'
119+
dependencies {
120+
// The BOM will manage the module versions and transitive dependencies
121+
implementation platform('com.google.auth:google-auth-library-bom:1.30.1')
122+
// Replace with the module(s) that are needed
123+
implementation 'com.google.auth:google-auth-library-oauth2-http'
124+
}
125+
74126
```
75127
[//]: # ({x-version-update-end})
76128

129+
Unfortunately, SBT [cannot](https://github.com/sbt/sbt/issues/4531) manage dependencies via Maven
130+
Bills of Materials. Therefore, you will have to add the submodule directly. Make sure the module
131+
versions are aligned in case you are using more than one authentication module in order to prevent
132+
transitive dependency conflicts.
77133
If you are using SBT, add this to your dependencies
78134

79135
[//]: # ({x-version-update-start:google-auth-library-oauth2-http:released})
80136
```Scala
81-
libraryDependencies += "com.google.auth" % "google-auth-library-oauth2-http" % "1.19.0"
137+
// Replace this with the implementation module that suits your needs
138+
libraryDependencies += "com.google.auth" % "google-auth-library-oauth2-http" % "1.30.1"
82139
```
83140
[//]: # ({x-version-update-end})
84141

0 commit comments

Comments
 (0)