Create Maven Central credentials
Some Gerrit artifacts (e.g. the Gerrit WAR file, the Gerrit Plugin API
and the Gerrit Extension API) are published on Maven Central in the
com.google.gerrit repository.
To be able to publish artifacts to Maven Central some preparations must be done:
-
Create an account by following instructions at Maven Central Portal.
Sonatype is the company that runs Maven Central and you need a Sonatype account to be able to upload artifacts to Maven Central.
Once you login you must generate a new user token that allows you to make requests via the publisher API. You can follow instructions here on how to do this.
Take note of this user and token. You will need to use them when running the release pipeline as described in the relevant documentation.
-
Request permissions to upload artifacts to the
com.google.gerritrepository on Maven Central:To acquire permission to upload artifacts to the
com.google.gerritrepository on Maven Central You must follow instructions here.The request needs to be approved by someone who already has this permission by commenting on the same issue.
-
Generate and publish a PGP key
A PGP key is needed to be able to sign the release artifacts before the upload to Maven Central, and to sign the release announcement email.
Generate and publish a PGP key as described in Working with PGP Signatures.
Please be aware that after publishing your public key it may take a while until it is visible to the Sonatype server.
Add an entry for the public key in the key list on the homepage.
The GPG private key and your passphrase will be required when running the release pipeline as described in the relevant documentation.
Deploy Configuration in Maven settings.xml
Gerrit Subproject Artifacts are stored on
Google Cloud Storage.
Via the Developers Console the
Gerrit maintainers have access to the Gerrit Code Review project.
This projects host several buckets for storing Gerrit artifacts:
-
gerrit-api:Bucket to store the Gerrit Extension API Jar and the Gerrit Plugin API Jar.
-
gerrit-maven:Bucket to store Gerrit Subproject Artifacts (e.g. Prolog Cafe).
To upload artifacts to a bucket the user must authenticate with a username and password. The username and password need to be retrieved from the Storage Setting in the Google Cloud Platform Console:
Select the Interoperability tab, and if no keys are listed under
Interoperable storage access keys, select 'Create a new key'.
Using Access Key as username and Secret as the password, add the
configuration in the ~/.m2/settings.xml file to make the credentials
known to Maven:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>gerrit-api-repository</id>
<username>GOOG..EXAMPLE.....EXAMPLE</username>
<password>EXAMPLE..EXAMPLE..EXAMPLE</password>
</server>
<server>
<id>gerrit-maven-repository</id>
<username>GOOG..EXAMPLE.....EXAMPLE</username>
<password>EXAMPLE..EXAMPLE..EXAMPLE</password>
</server>
<server>
<id>gerrit-plugins-repository</id>
<username>GOOG..EXAMPLE.....EXAMPLE</username>
<password>EXAMPLE..EXAMPLE..EXAMPLE</password>
</server>
</servers>
</settings>
Gerrit Subprojects
-
You will need to have the following in the
pom.xmlto make it deployable to thegerrit-mavenstorage bucket:
<distributionManagement>
<repository>
<id>gerrit-maven-repository</id>
<name>Gerrit Maven Repository</name>
<url>gs://gerrit-maven</url>
<uniqueVersion>true</uniqueVersion>
</repository>
</distributionManagement>
|
Note
|
In case of JGit the pom.xml already contains a distributionManagement
section. To deploy the artifacts to the gerrit-maven repository, replace
the existing distributionManagement section with this snippet.
|
-
Add these two snippets to the
pom.xmlto enable the wagon provider:
<pluginRepositories>
<pluginRepository>
<id>gerrit-maven</id>
<url>https://gerrit-maven.commondatastorage.googleapis.com</url>
</pluginRepository>
</pluginRepositories>
<build>
<extensions>
<extension>
<groupId>com.googlesource.gerrit</groupId>
<artifactId>gs-maven-wagon</artifactId>
<version>3.3</version>
</extension>
</extensions>
</build>
Part of Gerrit Code Review