Skip to main content
설명서에 자주 업데이트를 게시하며 이 페이지의 번역이 계속 진행 중일 수 있습니다. 최신 정보는 영어 설명서를 참조하세요.

Apache Maven 레지스트리 작업

패키지를 GitHub Packages에 게시하고 GitHub Packages에 저장된 패키지를 Java 프로젝트의 종속성으로 사용하도록 Apache Maven을 구성할 수 있습니다.

GitHub Packages은(는) GitHub Free, GitHub Pro, 조직의 경우 GitHub Free, GitHub Team, GitHub Enterprise Cloud, GitHub Enterprise Server 3.0 이상 및 GitHub AE에서 사용할 수 있습니다.

GitHub Packages는 레거시 리포지토리별 플랜을 사용하는 계정이 소유한 프라이빗 리포지토리에서 사용할 수 없습니다. 또한 레거시 리포지토리별 계획을 사용하는 계정은 세분화된 권한을 지원하는 레지스트리에 액세스할 수 없습니다. 이러한 계정은 리포지토리에서 청구되기 때문입니다. 세분화된 권한을 지원하는 레지스트리 목록은 "GitHub 패키지에 대한 사용 권한 정보"을 참조하세요. 자세한 내용은 "AUTOTITLE"을 참조하세요.

Authenticating to GitHub Packages

GitHub Packages only supports authentication using a personal access token (classic). For more information, see "Creating a personal access token."

You need an access token to publish, install, and delete private, internal, and public packages.

You can use a personal access token (classic) to authenticate to GitHub Packages or the GitHub API. When you create a personal access token (classic), you can assign the token different scopes depending on your needs. For more information about packages-related scopes for a personal access token (classic), see "About permissions for GitHub Packages."

To authenticate to a GitHub Packages registry within a GitHub Actions workflow, you can use:

  • GITHUB_TOKEN to publish packages associated with the workflow repository.
  • a personal access token (classic) with at least read:packages scope to install packages associated with other private repositories (which GITHUB_TOKEN can't access).

For more information about GITHUB_TOKEN used in GitHub Actions workflows, see "Automatic token authentication."

Authenticating with a personal access token

You must use a personal access token (classic) with the appropriate scopes to publish and install packages in GitHub Packages. For more information, see "Introduction to GitHub Packages."

You can authenticate to GitHub Packages with Apache Maven by editing your ~/.m2/settings.xml file to include your personal access token (classic). Create a new ~/.m2/settings.xml file if one doesn't exist.

In the servers tag, add a child server tag with an id, replacing USERNAME with your GitHub username, and TOKEN with your personal access token.

In the repositories tag, configure a repository by mapping the id of the repository to the id you added in the server tag containing your credentials. Replace OWNER with the name of the personal account or organization that owns the repository. Because uppercase letters aren't supported, you must use lowercase letters for the repository owner even if the GitHub user or organization name contains uppercase letters.

If you want to interact with multiple repositories, you can add each repository to separate repository children in the repositories tag, mapping the id of each to the credentials in the servers tag.

GitHub Packages supports SNAPSHOT versions of Apache Maven. To use the GitHub Packages repository for downloading SNAPSHOT artifacts, enable SNAPSHOTS in the POM of the consuming project or your ~/.m2/settings.xml file.

<settings xmlns=""




Publishing a package

By default, GitHub publishes the package to an existing repository with the same name as the package. For example, GitHub will publish a package named com.example:test in a repository called OWNER/test.

If you would like to publish multiple packages to the same repository, you can include the URL of the repository in the <distributionManagement> element of the pom.xml file. GitHub will match the repository based on that field. Since the repository name is also part of the distributionManagement element, there are no additional steps to publish multiple packages to the same repository.

For more information on creating a package, see the documentation.

  1. Edit the distributionManagement element of the pom.xml file located in your package directory, replacing OWNER with the name of the personal account or organization that owns the repository and REPOSITORY with the name of the repository containing your project.

         <name>GitHub OWNER Apache Maven Packages</name>
  2. Publish the package.

    $ mvn deploy

After you publish a package, you can view the package on GitHub. For more information, see "Viewing packages."

Installing a package

To install an Apache Maven package from GitHub Packages, edit the pom.xml file to include the package as a dependency. If you want to install packages from any repository for a specified repository owner, use a repository URL like*. For more information on using a pom.xml file in your project, see "Introduction to the POM" in the Apache Maven documentation.

  1. Authenticate to GitHub Packages. For more information, see "Authenticating to GitHub Packages."

  2. Add the package dependencies to the dependencies element of your project pom.xml file, replacing com.example:test with your package.

  3. Install the package.

    $ mvn install

Further reading