{"id":19032744,"url":"https://github.com/joutvhu/publish-maven-guide","last_synced_at":"2026-05-14T22:31:27.160Z","repository":{"id":182299772,"uuid":"668247698","full_name":"joutvhu/publish-maven-guide","owner":"joutvhu","description":"How to publish Java library to Maven Repository","archived":false,"fork":false,"pushed_at":"2023-07-19T11:17:09.000Z","size":128,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-21T20:36:44.021Z","etag":null,"topics":["guide","maven","publish","training"],"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/joutvhu.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}},"created_at":"2023-07-19T11:12:10.000Z","updated_at":"2023-07-19T11:18:20.000Z","dependencies_parsed_at":"2023-07-19T13:44:55.688Z","dependency_job_id":null,"html_url":"https://github.com/joutvhu/publish-maven-guide","commit_stats":null,"previous_names":["joutvhu/publish-maven-guide"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/joutvhu/publish-maven-guide","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joutvhu%2Fpublish-maven-guide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joutvhu%2Fpublish-maven-guide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joutvhu%2Fpublish-maven-guide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joutvhu%2Fpublish-maven-guide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joutvhu","download_url":"https://codeload.github.com/joutvhu/publish-maven-guide/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joutvhu%2Fpublish-maven-guide/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33045566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"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":["guide","maven","publish","training"],"created_at":"2024-11-08T21:30:46.887Z","updated_at":"2026-05-14T22:31:27.141Z","avatar_url":"https://github.com/joutvhu.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Publish Java library to Maven Repository\n\n## Create a JIRA Account and Request a Ticket\n\nFirst, you will need to have a [Sonatype JIRA](https://issues.sonatype.org) account to open a new ticket to request your access to publish your artifact.\n\nThen, create a JIRA ticket to fill your information.\n\n![alt text](./doc/create-ticket.png)\n\nYou have to fill your domain name or use your github domain into Group Id field. Then prove ownership by adding a text record to your domain or create a repository with the specified name.\n\n## Create a GPG key\n\nYou will also need a private key to sign the artifact.\n\n- [Use Git](https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key)\n\n- [Use Tool](https://www.openpgp.org/software/)\n\nPublish your GPG certificate to key servers. Recommended: https://keyserver.ubuntu.com\n\n## Save your Environment Variables\n\nYou can safely store your credentials into the .m2/settings.xml file in your\nuser's home directory.\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 https://maven.apache.org/xsd/settings-1.0.0.xsd\"\u003e\n    \u003cservers\u003e\n        \u003cserver\u003e\n            \u003cid\u003eossrh\u003c/id\u003e\n            \u003cusername\u003e{ username }\u003c/username\u003e\n            \u003cpassword\u003e{ password }\u003c/password\u003e\n        \u003c/server\u003e\n    \u003c/servers\u003e\n    \u003cprofiles\u003e\n        \u003cprofile\u003e\n            \u003cid\u003eossrh\u003c/id\u003e\n            \u003cactivation\u003e\n                \u003cactiveByDefault\u003etrue\u003c/activeByDefault\u003e\n            \u003c/activation\u003e\n            \u003cproperties\u003e\n                \u003cgpg.executable\u003egpg\u003c/gpg.executable\u003e\n                \u003cgpg.keyname\u003e{ gpg-key }\u003c/gpg.keyname\u003e\n                \u003cgpg.passphrase\u003e{ gpg-passphrase }\u003c/gpg.passphrase\u003e\n            \u003c/properties\u003e\n        \u003c/profile\u003e\n    \u003c/profiles\u003e\n\u003c/settings\u003e\n```\n\n## Set Up Maven in the Project\n\n```xml\n\u003cmodelVersion\u003e4.0.0\u003c/modelVersion\u003e\n\u003cgroupId\u003ecom.github.joutvhu\u003c/groupId\u003e\n\u003cartifactId\u003etest\u003c/artifactId\u003e\n\u003cversion\u003e1.0-SNAPSHOT\u003c/version\u003e\n\u003cname\u003etest\u003c/name\u003e\n\u003cdescription\u003eTest Lib\u003c/description\u003e\n\u003curl\u003ehttps://github.com/joutvhu/test\u003c/url\u003e\n\u003corganization\u003e\n    \u003cname\u003eGiao Ho\u003c/name\u003e\n    \u003curl\u003ehttps://github.com/joutvhu\u003c/url\u003e\n\u003c/organization\u003e\n\u003clicenses\u003e\n    \u003clicense\u003e\n        \u003cname\u003eMIT License\u003c/name\u003e\n        \u003curl\u003ehttps://github.com/joutvhu/test/blob/master/LICENSE\u003c/url\u003e\n    \u003c/license\u003e\n\u003c/licenses\u003e\n\u003cdevelopers\u003e\n    \u003cdeveloper\u003e\n        \u003cid\u003ejoutvhu\u003c/id\u003e\n        \u003cname\u003eGiao Ho\u003c/name\u003e\n        \u003cemail\u003ejoutvhu@gmail.com\u003c/email\u003e\n    \u003c/developer\u003e\n\u003c/developers\u003e\n\u003cscm\u003e\n    \u003cconnection\u003escm:git:git@github.com:joutvhu/test.git\u003c/connection\u003e\n    \u003cdeveloperConnection\u003escm:git:git@github.com:joutvhu/test.git\u003c/developerConnection\u003e\n    \u003curl\u003ehttps://github.com/joutvhu/test\u003c/url\u003e\n\u003c/scm\u003e\n\u003cissueManagement\u003e\n    \u003csystem\u003eGithub Issue\u003c/system\u003e\n    \u003curl\u003ehttps://github.com/joutvhu/test/issues\u003c/url\u003e\n\u003c/issueManagement\u003e\n```\n\n## Build Config\n\nThis will add the configuration for the build tag.\n\nAdd the following maven plugins:\n\n```xml\n\u003cbuild\u003e\n    \u003cplugins\u003e\n        \u003cplugin\u003e\n            \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n            \u003cartifactId\u003emaven-source-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e3.2.1\u003c/version\u003e\n            \u003cexecutions\u003e\n                \u003cexecution\u003e\n                    \u003cid\u003eattach-sources\u003c/id\u003e\n                    \u003cgoals\u003e\n                        \u003cgoal\u003ejar-no-fork\u003c/goal\u003e\n                    \u003c/goals\u003e\n                \u003c/execution\u003e\n            \u003c/executions\u003e\n        \u003c/plugin\u003e\n        \u003cplugin\u003e\n            \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n            \u003cartifactId\u003emaven-javadoc-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e3.4.1\u003c/version\u003e\n            \u003cexecutions\u003e\n                \u003cexecution\u003e\n                    \u003cid\u003eattach-javadocs\u003c/id\u003e\n                    \u003cgoals\u003e\n                        \u003cgoal\u003ejar\u003c/goal\u003e\n                    \u003c/goals\u003e\n                \u003c/execution\u003e\n            \u003c/executions\u003e\n            \u003cconfiguration\u003e\n                \u003cjavadocExecutable\u003e\n                    ${java.home}/bin/javadoc\n                \u003c/javadocExecutable\u003e\n            \u003c/configuration\u003e\n        \u003c/plugin\u003e\n        \u003cplugin\u003e\n            \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n            \u003cartifactId\u003emaven-surefire-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e2.22.2\u003c/version\u003e\n        \u003c/plugin\u003e\n        \u003cplugin\u003e\n            \u003cgroupId\u003eorg.sonatype.plugins\u003c/groupId\u003e\n            \u003cartifactId\u003enexus-staging-maven-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e1.6.13\u003c/version\u003e\n            \u003cextensions\u003etrue\u003c/extensions\u003e\n            \u003cconfiguration\u003e\n                \u003cserverId\u003eossrh\u003c/serverId\u003e\n                \u003cnexusUrl\u003ehttps://oss.sonatype.org/\u003c/nexusUrl\u003e\n                \u003cautoReleaseAfterClose\u003etrue\u003c/autoReleaseAfterClose\u003e\n            \u003c/configuration\u003e\n        \u003c/plugin\u003e\n        \u003cplugin\u003e\n            \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n            \u003cartifactId\u003emaven-gpg-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e3.0.1\u003c/version\u003e\n            \u003cexecutions\u003e\n                \u003cexecution\u003e\n                    \u003cid\u003esign-artifacts\u003c/id\u003e\n                    \u003cphase\u003everify\u003c/phase\u003e\n                    \u003cgoals\u003e\n                        \u003cgoal\u003esign\u003c/goal\u003e\n                    \u003c/goals\u003e\n                \u003c/execution\u003e\n            \u003c/executions\u003e\n        \u003c/plugin\u003e\n    \u003c/plugins\u003e\n\u003c/build\u003e\n```\n\n## Distribution Management Config\n\nAdd this child to the project's root:\n\n```xml\n\u003cdistributionManagement\u003e\n    \u003csnapshotRepository\u003e\n        \u003cid\u003eossrh\u003c/id\u003e\n        \u003curl\u003ehttps://oss.sonatype.org/content/repositories/snapshots\u003c/url\u003e\n    \u003c/snapshotRepository\u003e\n    \u003crepository\u003e\n        \u003cid\u003eossrh\u003c/id\u003e\n        \u003curl\u003ehttps://oss.sonatype.org/service/local/staging/deploy/maven2\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/distributionManagement\u003e\n```\n\n## Uploading to Sonatype Repository\n\nAdd \"-SNAPSHOT\" if you will deploy to the snapshot repository. For example:\n\n```\n\u003cversion\u003e1.0.0-SNAPSHOT\u003c/version\u003e\n```\nor else:\n```\n\u003cversion\u003e1.0.0\u003c/version\u003e\n```\n\nThen run the following command to upload your library.\n\n```sh\nmvn deploy\n```\n\nNow go to https://oss.sonatype.org and login to check result.\n\n![alt text](./doc/result.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoutvhu%2Fpublish-maven-guide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoutvhu%2Fpublish-maven-guide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoutvhu%2Fpublish-maven-guide/lists"}