Skip to content

clarityai-eng/codeartifact-gradle-plugin

Repository files navigation

Codeartifact gradle plugin

Gradle plugin which authenticates against AWS CodeArtifact using your local credentials to obtain the token.

Usage

In your build.gradle file:

plugins {
    id 'ai.clarity.codeartifact' version '0.0.11'
}

repositories {
    maven {
        url 'https://domain-id.d.codeartifact.eu-central-1.amazonaws.com/maven/repository/'
    }
}

publishing {
    repositories {
        maven {
            url 'https://domain-id.d.codeartifact.eu-central-1.amazonaws.com/maven/repository/'
        }
    }
}

Advanced Usage

If you need a concrete profile for AWS authentication you have 4 different options:

1 - Add the profile name to the repository url as a query param:

repositories {
    maven {
        url 'https://domain-id.d.codeartifact.eu-central-1.amazonaws.com/maven/repository/?profile=prod'
    }
}

Note: The query param is used to configure the profile and automatically removed from the url in any request to AWS.

2 - Define the environment var AWS_PROFILE with the profile name you want to use

This plugin uses AWS SDK for authorization, all the standard environment vars are applicable.

3 - Define the environment var CODEARTIFACT_PROFILE with the profile name you want to use

If you need a different profile for codeartifact than for the rest of AWS calls you can use this environment var.

4 - Define the profile using a system property

If you need a different profile for codeartifact and you cannot define a enviroment variable, you can define it via system property also:

This way using gradle.properties file:

systemProp.codeartifact.profile=<your profile>

Or using command line:

gradle -Dcodeartifact.profile=<your profile> ...