Setting up Maven
-
Open the file with the global Maven settings.
By default, the configuration file is located in the current user's
.m2
directory (~/.m2/settings.xml
for Unix-like OSes and%USERPROFILE%\.m2\settings.xml
for Windows). You can learn more about the configuration file structure in the Maven documentation . -
Add a new repository to the configuration file's
repositories
section:<repository> <id>local</id> <url>registry.yandexcloud.net/maven/<registry_ID></url> </repository>
-
Depending on the authentication method:
IAM tokenOAuth token-
Get an IAM token for the Yandex account or service account you are going to use for authentication.
-
Add a new server to the
servers
section of the Maven settings:<server> <id>local</id> <username>${env.REGISTRY_USERNAME}</username> <password>${env.REGISTRY_PASSWORD}</password> </server>
-
Create environment variables named
REGISTRY_USERNAME
andREGISTRY_PASSWORD
containing data for IAM token authentication:export REGISTRY_USERNAME="iam" export REGISTRY_PASSWORD="<IAM_token>"
Where
<IAM_token>
is the IAM token you got earlier.
-
Get
an OAuth token for the Yandex account you are going to use for authentication. -
Add a new server to the
servers
section of the Maven settings:<server> <id>local</id> <username>${env.REGISTRY_USERNAME}</username> <password>${env.REGISTRY_PASSWORD}</password> </server>
-
Create environment variables named
REGISTRY_USERNAME
andREGISTRY_PASSWORD
containing data for OAuth token authentication:export REGISTRY_USERNAME="oauth" export REGISTRY_PASSWORD="<OAuth_token>"
Where
<OAuth_token>
is the OAuth token you got earlier.
-