Artifactory远程仓库工件移动/复制失败求助(版本5.4.6)
Why You're Seeing These Errors
Let's break down the two issues you're facing:
Error when using the remote repository name:
Remote repositories in Artifactory don't store artifacts locally—they act as proxies to fetch artifacts from external sources. When you try to run themove/copyAPI against a remote repo directly, Artifactory tries to lock the associated cache repo (since that's where fetched artifacts are stored), but the API isn't designed to handle remote repos as sources for this operation. The "empty path" warning also confirms the remote repo itself has no local content to move/copy.Error when using the cache repository:
Cache repositories are read-only by design—they exist solely to store artifacts fetched from their parent remote repo. Artifactory explicitly blocks write operations like copy/move to cache repos to maintain consistency with the remote source.
Step-by-Step Fixes
Here's how to properly move/copy artifacts that exist in a remote repo's cache:
1. Identify Cached Artifacts First
Use the Artifactory REST API to list all artifacts stored in your remote repo's cache:
curl -k -u admin "https://myartifactory/artifactory/api/search/items?repo=generic-dev-cache"
This will return the full paths of all locally cached artifacts from the remote source.
2. Move/Copy to a Local Repository (Not a Cache)
Since cache repos can't be targets for write operations, switch your destination to a local repository (like generic-release you used earlier). Run the API against the cache repo, specifying either a single artifact path or the entire cache root:
# Move a specific cached artifact to local repo curl -k -X POST -u admin "https://myartifactory/artifactory/api/move/generic-dev-cache/path/to/artifact.jar?to=/generic-release/path/to/artifact.jar" # Move all cached artifacts (replace `move` with `copy` to keep the cache intact) curl -k -X POST -u admin "https://myartifactory/artifactory/api/move/generic-dev-cache/?to=/generic-release/"
The earlier 409 conflict occurred because you tried targeting another cache repo (generic-release-cache)—using a local repo eliminates this issue.
3. (Optional) Populate the Cache First
If the artifact you need isn't in the cache yet, fetch it explicitly to populate the cache before moving:
curl -k -u admin -X GET "https://myartifactory/artifactory/generic-dev/path/to/remote-artifact.jar"
This pulls the artifact from the remote source into generic-dev-cache, making it available for move/copy operations afterward.
Key Notes for Artifactory 5.4.6
- Remote repositories can't be used as sources for
move/copyoperations—always target their associated cache repos instead. - Cache repos are read-only for write operations; always use local repositories as destinations.
- When moving all artifacts from a cache repo, double-check the target is a local repo to avoid permission/conflict errors.
内容的提问来源于stack exchange,提问作者Marek Mrowca

