{"id":19974961,"url":"https://github.com/mark1708/github-maven-package-example","last_synced_at":"2025-08-05T18:06:17.314Z","repository":{"id":128499951,"uuid":"571787920","full_name":"Mark1708/github-maven-package-example","owner":"Mark1708","description":"This is a guide on using Apache Maven registry","archived":false,"fork":false,"pushed_at":"2022-11-29T14:48:41.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T18:46:16.108Z","etag":null,"topics":["github-registry","java","maven"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mark1708.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-28T22:10:45.000Z","updated_at":"2022-11-28T23:16:08.000Z","dependencies_parsed_at":"2023-04-18T01:49:42.891Z","dependency_job_id":null,"html_url":"https://github.com/Mark1708/github-maven-package-example","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Mark1708/github-maven-package-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mark1708%2Fgithub-maven-package-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mark1708%2Fgithub-maven-package-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mark1708%2Fgithub-maven-package-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mark1708%2Fgithub-maven-package-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mark1708","download_url":"https://codeload.github.com/Mark1708/github-maven-package-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mark1708%2Fgithub-maven-package-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268946027,"owners_count":24333456,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-05T02:00:12.334Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-registry","java","maven"],"created_at":"2024-11-13T03:16:43.529Z","updated_at":"2025-08-05T18:06:17.287Z","avatar_url":"https://github.com/Mark1708.png","language":"Java","readme":"# Apache Maven registry\n\n![Github](https://img.shields.io/badge/-Github-0a0a0a?style=for-the-badge\u0026logo=Github)\n![Maven](https://img.shields.io/badge/-Maven-0a0a0a?style=for-the-badge\u0026logo=ApacheMaven)\n\n### [Russian version](https://github.com/Mark1708/github-maven-package-example/blob/main/README.ru.md)\nYou can configure Apache Maven to publish packages to GitHub Packages and to use packages stored on GitHub Packages as dependencies in a Java project.\n\n## Generate a standard Maven project\n\n```bash\nmvn archetype:generate -DgroupId=example.com -DartifactId=github-maven-package-example -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false\n\nmvn validate\n\nmvn clean install\n```\n\n## Edit pom.xml\n\n#### Update properties\n\n```xml\n\u003cproperties\u003e  \n  \u003cproject.build.sourceEncoding\u003eUTF-8\u003c/project.build.sourceEncoding\u003e  \n  \u003cmaven.compiler.source\u003e11\u003c/maven.compiler.source\u003e  \n  \u003cmaven.compiler.target\u003e11\u003c/maven.compiler.target\u003e  \n  \u003cjava.version\u003e11\u003c/java.version\u003e  \n  \n  \u003cgithub.maven-plugin\u003e0.12\u003c/github.maven-plugin\u003e  \n  \u003cgithub.repository.owner\u003eGITHUB_USERNAME\u003c/github.repository.owner\u003e  \n  \u003cgithub.repository.name\u003eGITHUB_REPO\u003c/github.repository.name\u003e  \n\u003c/properties\u003e\n```\n\u003e Replacing \u003cGITHUB_USERNAME\u003e and \u003cGITHUB_REPO\u003e with real data\n\n#### Add distributionManagement\n\n```xml\n\u003cdistributionManagement\u003e  \n  \u003crepository\u003e  \n    \u003cid\u003egithub\u003c/id\u003e  \n    \u003cname\u003eGitHub ${github.repository.owner} Apache Maven Packages\u003c/name\u003e  \n\t\u003curl\u003ehttps://maven.pkg.github.com/${github.repository.owner}/${github.repository.name}\u003c/url\u003e  \n  \u003c/repository\u003e  \n\u003c/distributionManagement\u003e\n```\n\n\n#### Update build\n\n```xml\n\u003cbuild\u003e  \n  \u003cpluginManagement\u003e  \n    \u003cplugins\u003e  \n      \u003cplugin\u003e  \n        \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e  \n        \u003cartifactId\u003emaven-plugin-plugin\u003c/artifactId\u003e  \n        \u003cversion\u003e3.6.0\u003c/version\u003e  \n        \u003cconfiguration\u003e  \n          \u003cskipErrorNoDescriptorsFound\u003etrue\u003c/skipErrorNoDescriptorsFound\u003e  \n        \u003c/configuration\u003e  \n      \u003c/plugin\u003e  \n      \u003cplugin\u003e  \n        \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e  \n        \u003cartifactId\u003emaven-site-plugin\u003c/artifactId\u003e  \n        \u003cversion\u003e3.9.1\u003c/version\u003e  \n      \u003c/plugin\u003e  \n    \u003c/plugins\u003e  \n  \u003c/pluginManagement\u003e  \n  \u003cplugins\u003e  \n    \u003cplugin\u003e  \n      \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e  \n      \u003cartifactId\u003emaven-compiler-plugin\u003c/artifactId\u003e  \n      \u003cversion\u003e3.8.1\u003c/version\u003e  \n      \u003cconfiguration\u003e  \n        \u003csource\u003e${java.version}\u003c/source\u003e  \n        \u003ctarget\u003e${java.version}\u003c/target\u003e  \n      \u003c/configuration\u003e  \n    \u003c/plugin\u003e  \n  \n    \u003cplugin\u003e  \n      \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e  \n      \u003cartifactId\u003emaven-release-plugin\u003c/artifactId\u003e  \n      \u003cversion\u003e3.0.0-M1\u003c/version\u003e  \n    \u003c/plugin\u003e  \n  \u003c/plugins\u003e  \n\u003c/build\u003e\n```\n\n## Add simple class User\n\n```java\npublic class User {  \n  \n    private String username;  \n    private String password;  \n  \n    public User(String username, String password) {  \n        this.username = username;  \n        this.password = password;  \n    }  \n    \n    public User() {  \n    }  \n    \n    public String getUsername() {  \n        return username;  \n    }  \n    \n    public void setUsername(String username) {  \n        this.username = username;  \n    }  \n    \n    public String getPassword() {  \n        return password;  \n    }  \n    \n    public void setPassword(String password) {  \n        this.password = password;  \n    }  \n    \n    @Override  \n    public boolean equals(Object o) {  \n        if (this == o) return true;  \n        if (!(o instanceof User)) return false;  \n        User user = (User) o;  \n        return getUsername().equals(user.getUsername()) \u0026\u0026 getPassword().equals(user.getPassword());  \n    }  \n    \n    @Override  \n    public int hashCode() {  \n        return Objects.hash(getUsername(), getPassword());  \n    }  \n    \n    @Override  \n    public String toString() {  \n        return \"User{\" +  \n                \"username='\" + username + '\\'' +  \n                \", password='\" + password + '\\'' +  \n                '}';  \n    }\n}\n```\n\n## Let's make sure we didn't make a mistake and install the packages\n\n```bash\nmvn validate\n\nmvn clean install\n```\n\n## Preparing for deployment\n\nEdit the file `~/.m2/settings.xml ` to prove to Github the seriousness of their intentions)\n\n`vim ~/.m2/settings.xml`\n\n```xml\n\u003csettings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n  xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0\n                      http://maven.apache.org/xsd/settings-1.0.0.xsd\"\u003e\n\n  \u003cactiveProfiles\u003e\n    \u003cactiveProfile\u003egithub\u003c/activeProfile\u003e\n  \u003c/activeProfiles\u003e\n\n  \u003cprofiles\u003e\n    \u003cprofile\u003e\n      \u003cid\u003egithub\u003c/id\u003e\n      \u003crepositories\u003e\n        \u003crepository\u003e\n          \u003cid\u003ecentral\u003c/id\u003e\n          \u003curl\u003ehttps://repo1.maven.org/maven2\u003c/url\u003e\n        \u003c/repository\u003e\n        \u003crepository\u003e\n          \u003cid\u003egithub\u003c/id\u003e\n          \u003curl\u003ehttps://maven.pkg.github.com/\u003cGITHUB_USERNAME\u003e/\u003cGITHUB_REPO\u003e\u003c/url\u003e\n          \u003csnapshots\u003e\n            \u003cenabled\u003etrue\u003c/enabled\u003e\n          \u003c/snapshots\u003e\n        \u003c/repository\u003e\n      \u003c/repositories\u003e\n    \u003c/profile\u003e\n  \u003c/profiles\u003e\n\n  \u003cservers\u003e\n    \u003cserver\u003e\n      \u003cid\u003egithub\u003c/id\u003e\n      \u003cusername\u003e\u003cGITHUB_USERNAME\u003e\u003c/username\u003e\n      \u003cpassword\u003e\u003cGITHUB_ACCESS_TOKEN\u003e\u003c/password\u003e\n    \u003c/server\u003e\n  \u003c/servers\u003e\n\u003c/settings\u003e\n```\n\n\u003e Replace \u003cGITHUB_USERNAME\u003e,  \u003cGITHUB_REPO\u003e and \u003cGITHUB_ACCESS_TOKEN\u003e with real data \u003c/br\u003e\n\u003e You need an access token to `publish, install, and delete private, internal, and public packages`.\n\n## Deploy\n\nEverything is simple here:\n```shell\nmvn deploy\n```\n\n## Result\nIn your repository you can find such a charm:\n```xml\n\u003cdependency\u003e  \n  \u003cgroupId\u003eexample.com\u003c/groupId\u003e  \n  \u003cartifactId\u003egithub-maven-package-example\u003c/artifactId\u003e  \n  \u003cversion\u003e1.0-SNAPSHOT\u003c/version\u003e  \n\u003c/dependency\u003e\n```\n\nIf the repository is public, then the dependency is available to everyone!\n\u003e But if you did it in private, then on the device where you will use this dependency, you will need to configure the same `~/.m2/settings.xml ` file.\n \n### Good luck !)\n\n## Other Resources\n-   [Boilerplates](https://github.com/Mark1708/boilerplates) - Templates for various projects\n-   [Cheat-Sheets](https://github.com/Mark1708/cheat-sheets) - Command Reference for various tools and technologies\n-   [Habr](https://habr.com/ru/users/Mark1708/posts) - Here I sometimes write about something interesting\n\n## Contact\nCreated by [Gurianov Mark](https://mark1708.github.io/) - feel free to contact me!\n#### +7(962)024-50-04 | mark1708.work@gmail.com | [github](http://github.com/Mark1708)\n\n![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=mark1708\u0026repo=github-maven-package-example\u0026theme=chartreuse-dark\u0026show_icons=true)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmark1708%2Fgithub-maven-package-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmark1708%2Fgithub-maven-package-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmark1708%2Fgithub-maven-package-example/lists"}