Skip to content

Maven extension that provides AWS CodeArtifact authentication

Notifications You must be signed in to change notification settings

dangernoodle-io/codeartifact-maven-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

codeartifact-maven-extension

maven maven-build maven-release Coverage Status

Maven build extension that provides a resolver and wagon implementation capable of authenticating against AWS CodeArtifact before uploading/downloading artifacts.

Java 8 or greater is required. The appropriate implementation will automatically be selected be based upon your maven version. See here for additional details.

Usage

The easiest way to configure the plugin is to add an entry to the .mvn/extensions.xml file (see here for more details) like so:

<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
  <extension>
     <groupId>io.dangernoodle</groupId>
     <artifactId>codeartifact-maven-extension</artifactId>
     <version>${codeartifact-maven-extension.version}</version>
  </extension>
</extensions>

This is the recommended approach if you use a parent pom that is also stored within codeartifact. If you have a standalone project and don't wish to use the .mvn directory, you can add the following to the build section of your project's pom:

<build>
  <extensions>
    <extension>
      <groupId>io.dangernoodle</groupId>
      <artifactId>codeartifact-maven-extension</artifactId>
      <version>${codeartifact-maven-extension.version}</version>
    </extension>
  </extensions>
  ...
</build>

Credentials

The wagon automatically uses the DefaultCredentialsProvider to find AWS credentials. Be sure you have configured your environment accordingly.

Separately, static credentials can be provided in an a server entry in maven-settings.xml

<servers>
  <server>
    <id>codeartifact</id>
    <username>AWS_ACCESS_KEY_ID</username>
    <password>AWS_SECRET_ACCESS_KEY</password>
  </server>
</servers>

Make sure you are using appropriate security precautions if you are using static credentials.