[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eArtifact Registry supports Java packages built with Maven and Gradle, offering resources like a quickstart guide for those new to the platform.\u003c/p\u003e\n"],["\u003cp\u003eUsers can create various repository types, including remote and virtual, and control access via specific permissions for accounts connecting to the repository.\u003c/p\u003e\n"],["\u003cp\u003eConfiguration for common tools like Maven, Gradle, and Cloud Build are supported, along with a community-created sbt plugin, and instructions to deploy to Google Cloud runtime environments.\u003c/p\u003e\n"],["\u003cp\u003eMaven differentiates between snapshot versions, which are pre-release and marked with \u003ccode\u003e-SNAPSHOT\u003c/code\u003e, and release versions, where the suffix is removed when the package is finalized.\u003c/p\u003e\n"],["\u003cp\u003eArtifact Registry offers different Maven version policies, such as storing both snapshot and release packages, or snapshot only or release only, with the option for unique or non-unique versions for snapshot packages.\u003c/p\u003e\n"]]],[],null,["# Manage Java packages\n\nArtifact Registry supports Java packages that you build with Maven and Gradle.\n\nOverview\n--------\n\nTo get familiar with Java packages in Artifact Registry, you can try the\n[quickstart](/artifact-registry/docs/java/quickstart).\n\nWhen you are ready to learn more, read the following information:\n\n1. [Create a Java package repository](/artifact-registry/docs/repositories/create-repos) for your packages.\n2. Learn how to create [remote](/artifact-registry/docs/repositories/remote-repo) and [virtual](/artifact-registry/docs/repositories/virtual-repo) repositories.\n3. Read about how remote and virtual repositories can be used in this [repository usage example](/artifact-registry/docs/repositories#repository_usage_example).\n4. [Grant permissions](/artifact-registry/docs/access-control) to the account that will connect with the repository. Service accounts for common integrations with Artifact Registry have default [permissions](/artifact-registry/docs/access-control#gcp) for repositories in the same project.\n5. Configure your tools:\n - [Configure authentication](/artifact-registry/docs/java/authentication) for Maven or Gradle.\n - If you want to use [sbt](https://www.scala-sbt.org/1.x/docs/Getting-Started.html) as a build tool for Scala and Java instead of using Maven or Gradle, there is a [community-created sbt plugin](https://index.scala-lang.org/abdolence/sbt-gcs-resolver/sbt-gcs-plugin/) available. This documentation does not describe configuration or usage of Scala clients..\n - [Configure Cloud Build](/artifact-registry/docs/configure-cloud-build) to upload and download packages.\n - Learn about [deploying](/artifact-registry/docs/deploy) to Google Cloud runtime environments.\n6. [Learn about managing packages](/artifact-registry/docs/java/manage-packages).\n\nMaven snapshot and release versions\n-----------------------------------\n\nMaven distinguishes between *snapshot* and *release* versions of your\nMaven projects.\n\n### Snapshots\n\nA snapshot is a pre-release version of a Java project. The version number\nfor a snapshot includes the suffix `-SNAPSHOT` in the your Project Object Model\n(POM). For example, this setting in the `pom.xml` file is for a `1.0` version\nof project that is in development: \n\n \u003cversion\u003e1.0-SNAPSHOT\u003c/version\u003e\n\nWhen you publish a package from this project, Maven 3 automatically appends\na timestamp to the snapshot version number so that each snapshot version is\nunique. Maven 2 supports non-unique snapshot versions as a means to overwrite\nexisting snapshots in a repository. This approach is problematic for\nreproducibility of builds, which is why Maven 3 no longer supports non-unique\nsnapshots.\n\nSnapshots provide a way for you to iteratively publish updated versions of a\npre-release package without incrementing the version number in your Maven\nproject every time that you publish to the repository. During development,\nother projects with dependencies on the package can then obtain the latest\nsnapshot of version `1.0` from the repository.\n\nRefer to\n[version order specification](https://maven.apache.org/pom.html#version-order-%0Aspecification) for details about Maven version number syntax\nand sort order.\n\n### Releases\n\nWhen you are ready to release a package, you remove the `-SNAPSHOT` suffix\nfrom the version number in the POM file and update any projects that depend on\nthe package so that they use the release version instead of the snapshot\nversion.\n\nTo list all snapshot dependencies, you can\n[filter the dependency tree](https://maven.apache.org/plugins/maven-dependency-plugin/examples/filtering-the-dependency-tree.html)\nwith the command: \n\n mvn dependency:tree -Dincludes=:::*-SNAPSHOT\n\n### Artifact Registry version policy\n\nWhen you create a Maven repository in Artifact Registry, you can specify a\nMaven version policy:\n\n- None - Stores both snapshot and release packages. This is the default setting.\n- Snapshot - Stores snapshot packages only.\n- Release - Stores release packages only.\n\nIf you choose the snapshot version policy, you can also specify whether the\nrepository allows non-unique snapshot versions that overwrite matching versions\nin the repository. We recommend using unique versions since Maven 3 does not\nsupport the non-unique version model."]]