|
118 | 118 | </dependencies> |
119 | 119 | </dependencyManagement> |
120 | 120 | <build> |
| 121 | + <pluginManagement> |
| 122 | + <plugins> |
| 123 | + <plugin> |
| 124 | + <groupId>org.sonatype.plugins</groupId> |
| 125 | + <artifactId>nexus-staging-maven-plugin</artifactId> |
| 126 | + <version>1.7.0</version> |
| 127 | + <extensions>true</extensions> |
| 128 | + <configuration> |
| 129 | + <serverId>sonatype-nexus-staging</serverId> |
| 130 | + <nexusUrl>https://google.oss.sonatype.org/</nexusUrl> |
| 131 | + <autoReleaseAfterClose>false</autoReleaseAfterClose> |
| 132 | + </configuration> |
| 133 | + </plugin> |
| 134 | + </plugins> |
| 135 | + </pluginManagement> |
121 | 136 | <plugins> |
122 | | - <plugin> |
123 | | - <groupId>org.sonatype.plugins</groupId> |
124 | | - <artifactId>nexus-staging-maven-plugin</artifactId> |
125 | | - <version>1.7.0</version> |
126 | | - <extensions>true</extensions> |
127 | | - <configuration> |
128 | | - <serverId>sonatype-nexus-staging</serverId> |
129 | | - <nexusUrl>https://google.oss.sonatype.org/</nexusUrl> |
130 | | - <autoReleaseAfterClose>false</autoReleaseAfterClose> |
131 | | - </configuration> |
132 | | - </plugin> |
133 | 137 | <plugin> |
134 | 138 | <groupId>org.apache.maven.plugins</groupId> |
135 | 139 | <artifactId>maven-javadoc-plugin</artifactId> |
|
158 | 162 | </build> |
159 | 163 |
|
160 | 164 | <profiles> |
| 165 | + <profile> |
| 166 | + <!-- By default, we release artifacts to Sonatype, which requires |
| 167 | + nexus-staging-maven-plugin. --> |
| 168 | + <id>release-sonatype</id> |
| 169 | + <activation> |
| 170 | + <property> |
| 171 | + <!-- Only when we use the release-gcp-artifact-registry profile, |
| 172 | + which comes with artifact-registry-url property, this profile is |
| 173 | + turned off. --> |
| 174 | + <name>!artifact-registry-url</name> |
| 175 | + </property> |
| 176 | + </activation> |
| 177 | + <build> |
| 178 | + <plugins> |
| 179 | + <plugin> |
| 180 | + <groupId>org.sonatype.plugins</groupId> |
| 181 | + <artifactId>nexus-staging-maven-plugin</artifactId> |
| 182 | + </plugin> |
| 183 | + </plugins> |
| 184 | + </build> |
| 185 | + </profile> |
| 186 | + <profile> |
| 187 | + <!-- Optionally, we can publish the artifacts to GCP Artifact Registry specifying |
| 188 | + this release-gcp-artifact-registry profile: |
| 189 | + mvn deploy -P=release-gcp-artifact-registry -P=-release-sonatype \ |
| 190 | + -Dartifact-registry-url=artifactregistry://us-maven.pkg.dev/... |
| 191 | + --> |
| 192 | + <id>release-gcp-artifact-registry</id> |
| 193 | + <properties> |
| 194 | + <artifact-registry-url>artifactregistry://undefined-artifact-registry-url-value</artifact-registry-url> |
| 195 | + </properties> |
| 196 | + <distributionManagement> |
| 197 | + <repository> |
| 198 | + <id>gcp-artifact-registry-repository</id> |
| 199 | + <url>${artifact-registry-url}</url> |
| 200 | + </repository> |
| 201 | + <snapshotRepository> |
| 202 | + <id>gcp-artifact-registry-repository</id> |
| 203 | + <url>${artifact-registry-url}</url> |
| 204 | + </snapshotRepository> |
| 205 | + </distributionManagement> |
| 206 | + </profile> |
161 | 207 | <profile> |
162 | 208 | <id>release-sign-artifacts</id> |
163 | 209 | <activation> |
|
0 commit comments