aws-toolkit-jetbrains
aws-toolkit-jetbrains copied to clipboard
Using CodeArtifact with Maven from IntelliJ
Is your feature request related to a problem? Please describe.
Maven requires the following configuration in ~/.m2/settings.xml for CodeArtifact:
<server>
<id>codeartifact</id>
<username>aws</username>
<password>${env.CODEARTIFACT_AUTH_TOKEN}</password>
</server>
This requires first exporting the CODEARTIFACT_AUTH_TOKEN like:
export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain mydomain --query authorizationToken --output text`
And then launching IntelliJ.
Furthermore, since the token only lasts up to 12hours, it's not possible to update this token without re-launching IntelliJ.
Describe the solution you'd like
Have the IntelliJ plugin overwrite the value of CODEARTIFACT_AUTH_TOKEN with a fresh token prior to resolving maven artifacts.
Describe alternatives you've considered
Another IntelliJ plugin that attempts to solve this by writing the value of the token directly into ~/.m2/settings.xml.
https://github.com/coderazzi/aws_codeartifact_maven
Additional context Gracefully handle profiles configured with AWS SSO and/or MFA.
Another workaround is to run mvn clean install or similar from command line to download a local copy of the dependencies. This is still painful and having a seamless integration as outlined above would be great.