[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[[["\u003cp\u003eMaven might struggle to resolve dependencies like parent projects or plugin dependencies stored in Artifact Registry, so you will need to use core extensions to let maven find parent POM files and plugins.\u003c/p\u003e\n"],["\u003cp\u003eTo enable Maven to locate these dependencies, create an \u003ccode\u003eextensions.xml\u003c/code\u003e file in your project's \u003ccode\u003e.mvn\u003c/code\u003e directory, defining the wagon extension for Artifact Registry.\u003c/p\u003e\n"],["\u003cp\u003eArtifact Registry allows uploading of new snapshot versions to a snapshot repository, but overwriting existing ones is only allowed in repositories with a specific snapshot version policy.\u003c/p\u003e\n"],["\u003cp\u003eNon-unique snapshots, a feature from Maven 2, are supported in Artifact Registry only if the snapshot repository is configured with a snapshot version policy.\u003c/p\u003e\n"],["\u003cp\u003eYou can check the version policy of a repository by using the \u003ccode\u003egcloud artifacts repositories describe\u003c/code\u003e command to see whether or not snapshots can overwrite each other.\u003c/p\u003e\n"]]],[],null,["# Troubleshoot Java package issues\n\nLearn about troubleshooting steps that you might find helpful if you run into\nproblems managing java packages in Artifact Registry.\n\n### Can't resolve a dependency stored in Artifact Registry\n\nMaven resolves some dependencies before applying a wagon defined in\n`pom.xml`, including:\n\n- References in a child Maven project to a parent project using the `\u003cparent\u003e` element.\n- Plugin dependencies stored in Artifact Registry.\n\nIf your project needs to resolve these dependencies, you must use the\n[core extensions](https://maven.apache.org/docs/3.3.1/release-notes.html)\nmechanism to ensure that Maven can locate parent POM files and plugins.\n\nIn your project, create the file `${maven.projectBasedir}/.mvn/extensions.xml`\nwith the following content. The `\u003cextension\u003e` element defines the\nwagon. \n\n \u003cextensions xmlns=\"http://maven.apache.org/EXTENSIONS/1.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:schemaLocation=\"http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd\"\u003e\n \u003cextension\u003e\n \u003cgroupId\u003ecom.google.cloud.artifactregistry\u003c/groupId\u003e\n \u003cartifactId\u003eartifactregistry-maven-wagon\u003c/artifactId\u003e\n \u003cversion\u003e2.2.5\u003c/version\u003e\n \u003c/extension\u003e\n \u003c/extensions\u003e\n\n### Can't upload non-unique snapshots to a snapshot repository\n\nYou can upload snapshot versions that do not exist in an Artifact Registry\nsnapshot repository, but you cannot overwrite a version that already exists in\nthe repository.\n\nNon-unique snapshots are a feature of Maven 2. Maven 3 always adds a timestamp\nto snapshot version numbers so that every snapshot version is unique.\n\nArtifact Registry only supports non-unique snapshot versions in\nrepositories with a snapshot version policy. By default snapshot repositories\nonly accept unique snapshot versions. You can only set a version policy when\nyou create the repository.\n\nTo find out the version policy settings for a repository, run the following\ncommand: \n\n gcloud artifacts repositories describe \u003cvar translate=\"no\"\u003eREPOSITORY\u003c/var\u003e \\\n [--project=\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e] \\\n [--location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e]\n\nWhere\n\n- \u003cvar translate=\"no\"\u003eREPOSITORY\u003c/var\u003e is the ID of the repository. If you configured a [default](/artifact-registry/docs/gcloud-defaults) Artifact Registry repository, it is used when this flag is omitted from the command.\n- \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e is the project ID. If this flag is omitted, the current or [default project](/artifact-registry/docs/gcloud-defaults#project) is used.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e is the regional or multi-regional [location](/artifact-registry/docs/repo-locations) for the repository.\n\nThe output of the command includes information about the version policy\nunder `mavenConfig`. In the following example, the repository has a snapshot\nversion policy and snapshots cannot overwrite identical versions in the\nrepository. \n\n Encryption: Google-managed key\n createTime: '2021-09-23T19:39:10.897404Z'\n format: MAVEN\n mavenConfig:\n allowSnapshotOverwrites: false\n versionPolicy: SNAPSHOT"]]