AWS CLI CodeArtifact : What value to supply for --package flag for list-package-versions subcommand
Problem Statement
I am trying to see what versions have been deployed for a specific Maven package in AWS CodeArtifact. I do not have the ability to view anything through the web GUI so I am using the AWS CLI.
When I run the following command aws codeartifact list-packages --domain kickingtires --repository kickingtires
the output looks as follows
PACKAGES maven edu.excelsior.api core
So basically there is one Maven artifact in the kickingtires repository : edu.excelsior.api:core
. I have deployed two versions of this artifact and want to list the versions using the AWS CLI.
I have tried to run the following permutations
aws codeartifact list-package-versions --domain kickingtires --repository kickingtires --format maven --package edu.excelsior.api
aws codeartifact list-package-versions --domain kickingtires --repository kickingtires --format maven --package edu.excelsior.api.core
aws codeartifact list-package-versions --domain kickingtires --repository kickingtires --format maven --package edu.excelsior.api:core
aws codeartifact list-package-versions --domain kickingtires --repository kickingtires --format maven --package "edu.excelsior.api"
aws codeartifact list-package-versions --domain kickingtires --repository kickingtires --format maven --package "edu.excelsior.api.core"
aws codeartifact list-package-versions --domain kickingtires --repository kickingtires --format maven --package "edu.excelsior.api:core"
However the response is always as follows
An error occurred (ResourceNotFoundException) when calling the ListPackageVersions operation: The maven package '$PACKAGE' does not exist in repository 'kickingtires
Question
What is the appropriate value of the --package parameter for the list-package-versions subcommand to retrieve the Maven artifact versions? I have checked the AWS Documentation but it doesn't have a meaningful answer to this question
Solution 1:
This may be too late to be helpful to the original poster, but I just ran into this problem and hopefully my answer will help someone else. In order to target a package that has a namespace (groupId in maven speak), you need to include both --package
(just the package name/artifactId) and --namespace
(the groupId) to the line. You cannot target both with just --package
, at least I couldn't find out how, and you can't look for just the package name without the namespace, it will claim not to find it.
So I believe something like this should work:
aws codeartifact list-package-versions --domain kickingtires --repository kickingtires --format maven --namespace edu.excelsior.api --package core
Hope this help someone some day.