I have been searching a lot for getting a sample buildspec where integrates the codeartifacts with mvn.
here is my buildpsec is, following is my doubts.
- since we cannot create a setting.xml where aws tells us to mention the servers, mirrors, profile and token, how can we upload the dependencies to the artifact repository.
- my goal is to put only the resultant jar not the .m2/* all dependency in the artefact repository, moreover is it a good approach ?
buildspec file
version: 0.2
phases:
install:
runtime-versions:
java: openjdk8
commands:
- pip3 install awscli --upgrade --user
- export CODEARTIFACT_TOKEN=`aws codeartifact get-authorization-token --domain $DOMAIN --domain-owner $ACCOUNT_ID --query authorizationToken --output text`
build:
commands:
- echo Build started on `date`
- mvn package
artifacts:
type: zip
files:
- '/target/launcher-0.0.1-SNAPSHOT.jar'
cache:
paths:
- '/root/.m2/**/*'.