{"id":15068930,"url":"https://github.com/ehsaniara/maven-repository-aws-s3","last_synced_at":"2025-04-10T17:43:15.711Z","repository":{"id":45817622,"uuid":"251439530","full_name":"ehsaniara/maven-repository-aws-s3","owner":"ehsaniara","description":"Make AWS S3 Bucket as your private maven repository","archived":false,"fork":false,"pushed_at":"2024-10-07T03:25:51.000Z","size":286,"stargazers_count":14,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T15:21:57.840Z","etag":null,"topics":["aws","aws-s3","iam-users","java","java11","maven-plugin","maven-repository","oss","plugin","s3"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ehsaniara.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":"2020-03-30T22:08:39.000Z","updated_at":"2024-10-09T11:59:06.000Z","dependencies_parsed_at":"2025-02-17T18:47:27.087Z","dependency_job_id":null,"html_url":"https://github.com/ehsaniara/maven-repository-aws-s3","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehsaniara%2Fmaven-repository-aws-s3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehsaniara%2Fmaven-repository-aws-s3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehsaniara%2Fmaven-repository-aws-s3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ehsaniara%2Fmaven-repository-aws-s3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ehsaniara","download_url":"https://codeload.github.com/ehsaniara/maven-repository-aws-s3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248262233,"owners_count":21074269,"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","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":["aws","aws-s3","iam-users","java","java11","maven-plugin","maven-repository","oss","plugin","s3"],"created_at":"2024-09-25T01:39:45.952Z","updated_at":"2025-04-10T17:43:15.690Z","avatar_url":"https://github.com/ehsaniara.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# maven-repository-aws-s3\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.ehsaniara/maven-repository-aws-s3.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.ehsaniara%22%20AND%20a:%22maven-repository-aws-s3%22)\n[![License](https://travis-ci.org/ehsaniara/maven-repository-aws-s3.svg?branch=master)](https://travis-ci.org/ehsaniara/maven-repository-aws-s3.svg?branch=master)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.ehsaniara/maven-repository-aws-s3/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.ehsaniara/maven-repository-aws-s3)\n\n\n![AWS S3 and Maven](docs/maven-repository-aws-s3-0.png)\n\n**Introduction**\nWith the help of this maven-plugin you can create your own private Maven Repository with the essential features. There are many commercial products out there, for example: [Nexus](https://help.sonatype.com/repomanager3/formats/maven-repositories), [JFrog](https://jfrog.com/artifactory/) and ets.., but the drawback is they required more resources (Compute and storage) and some are costly. Where you can simply setup in your AWS cloud with much much less cost.\n \n![High Level Arch.](docs/maven-repository-aws-s3-1.png)\n\n**Start Here**\n\n* [Configure AWS Pre-Req](#Configure-AWS-Pre-Req)\n* [Configure By AWS CLI (No ready yet)](#Configure-By-AWS-CLI)\n* [Configure By AWS Console](#Configure-By-AWS-Console)\n    * [Create S3 Bucket](#Create-S3-Bucket)\n    * [Create Policy](#Create-Policy)\n    * [Create IAM USER](#Create-IAM-USER)\n* [Local PC Setup](#Local-PC-Setup)\n* [CI/CD Pipeline Setup](#CI-CD-Pipeline-Setup)\n* [Reference](#Reference)\n\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.ehsaniara/maven-repository-aws-s3/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.ehsaniara/maven-repository-aws-s3)\n[![License](https://travis-ci.org/ehsaniara/maven-repository-aws-s3.svg?branch=master)](https://travis-ci.org/ehsaniara/maven-repository-aws-s3.svg?branch=master)\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.ehsaniara/maven-repository-aws-s3.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.ehsaniara%22%20AND%20a:%22maven-repository-aws-s3%22)\n\n\u003ca name=\"Configure-AWS-Pre-Req\"\u003e\u003c/a\u003e\n## Configure AWS Pre-Req\nCreate IAM User, -Rule and -Policy.\n\nYou can use both AWS-CLI or Web Console (browser: https://aws.amazon.com/)\n\n##### NOTE: Java 1.8 and 11 supporteds\n\n\u003ca name=\"Configure-By-AWS-CLI\"\u003e\u003c/a\u003e\n## Configure By AWS CLI:\n\n\u003e Note: make sure that you have latest AWS CLI installed in your PC.\n\u003e Note: make sure that you are in your project root directory and have permission to create a file.\n\n```shell script\ncurl -s https://raw.githubusercontent.com/ehsaniara/maven-repository-aws-s3/master/aws-s3-setup.sh | bash /dev/stdin bucket_name username\n```\n###### Note: Currently AWS CLI script is not completed, Please try AWS Console one\n\n\u003ca name=\"Configure-By-AWS-Console\"\u003e\u003c/a\u003e\n## Configure By AWS Console\n(browser: https://aws.amazon.com/)\n\n\u003ca name=\"Create-S3-Bucket\"\u003e\u003c/a\u003e\n### Create S3 Bucket\n\nCreate a AWS S3 bucket, try to have unique name from you domain, for example: ```my-project-com-maven-repository```\n###### Note: Block all public access on the bucket\nand also create 2 folder of ```release``` and ```snapshot``` in it.\n\n\u003ca name=\"Create-Policy\"\u003e\u003c/a\u003e\n### Create Policy\nCreate policy with the following json (select json tab):\n\n##### Note: dont forget to replace ```YOUR_BUCKET_NAME``` by your bucket name, for example: ```my-project-com-maven-repository```\n```json\n{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": [\n        \"s3:PutObject\",\n        \"s3:GetObject\",\n        \"s3:CreateBucket\",\n        \"s3:ListBucket\",\n        \"s3:DeleteObject\"\n      ],\n      \"Resource\": \"arn:aws:s3:::YOUR_BUCKET_NAME/*\"\n    }\n  ]\n}\n```\nthen give name to this policy. something similar to your bucket name, for example: ```my-project-com-maven-repository-policy``` and then create the policy.\n\n\u003ca name=\"Create-IAM-USER\"\u003e\u003c/a\u003e\n### Create IAM USER\non Add user, select a User name and make sure you have select the \"Programmatic access\"\nthen select \"Attach existing policies directly\", and in ```Filter policies``` box search for your the policy name you have just created.\nthen tag,review and create the user.\n\n\u003e Important: Make sure that you have download the .csv file and store it in the secure place. the credentials in this file is required to user in your ```~/.m2/setting.xml``` file\n\ncreate a user with (Programmatic access). \n\n* create separate user to access your S3 bucket, for the security reason you should not give admin permission. this user should have enough access to read and write in the bucket and no more than that.\n##### Note: you can have as many user (per team member) or single user just for repo access.\n\n\u003ca name=\"Local-PC-Setup\"\u003e\u003c/a\u003e\n## Local PC Setup\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.ehsaniara/maven-repository-aws-s3.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.ehsaniara%22%20AND%20a:%22maven-repository-aws-s3%22)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.ehsaniara/maven-repository-aws-s3/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.ehsaniara/maven-repository-aws-s3)\n\nIf you plane to deploy you project jar from your local machine you need to follow the following steps.\n\n* on your local maven setup directory ```.m2``` add the following XML snaps in ```setting.xml```. \nyou basically gave permission to maven to access the S3 bucket, to be able to push or pull the files. one for **snapshot** and one for **release**.\n\n##### Note: create ```setting.xml``` if it's not exist in ```.m2``` directory\n```xml\n\u003csettings\u003e\n  \u003cservers\u003e\n    ...\n    ...\n    \u003cserver\u003e\n      \u003cid\u003eYOUR_BUCKET_NAME-snapshot\u003c/id\u003e\n      \u003cusername\u003eAWS_ACCESS_KEY_ID\u003c/username\u003e\n      \u003cpassword\u003eAWS_SECRET_ACCESS_KEY\u003c/password\u003e\n      \u003cconfiguration\u003e\n        \u003cregion\u003eAWS_REGION\u003c/region\u003e\n        \u003cpublicRepository\u003efalse\u003c/publicRepository\u003e\n      \u003c/configuration\u003e\n    \u003c/server\u003e\n    \u003cserver\u003e\n      \u003cid\u003eYOUR_BUCKET_NAME-release\u003c/id\u003e\n      \u003cusername\u003eAWS_ACCESS_KEY_ID\u003c/username\u003e\n      \u003cpassword\u003eAWS_SECRET_ACCESS_KEY\u003c/password\u003e\n      \u003cconfiguration\u003e\n        \u003cregion\u003eAWS_REGION\u003c/region\u003e\n        \u003cpublicRepository\u003efalse\u003c/publicRepository\u003e\n      \u003c/configuration\u003e\n    \u003c/server\u003e\n    ....\n    ....\n  \u003c/servers\u003e\n\u003c/settings\u003e\n```\n\n* on your project ```pom.xml``` add the following xml to let maven **DOWNLOAD** your project artifactory from the maven-repo \n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003eYOUR_BUCKET_NAME-snapshot\u003c/id\u003e\n        \u003curl\u003es3://YOUR_BUCKET_NAME/snapshot\u003c/url\u003e\n    \u003c/repository\u003e\n    \u003crepository\u003e\n        \u003cid\u003eYOUR_BUCKET_NAME-release\u003c/id\u003e\n        \u003curl\u003es3://YOUR_BUCKET_NAME/release\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n\n```\n##### Note: make sure that```\u003cid\u003eYOUR_BUCKET_NAME-snapshot\u003c/id\u003e``` and ```\u003cid\u003eYOUR_BUCKET_NAME-release\u003c/id\u003e``` should be identical with your ```.m2/setting.xml``` ids\n\n* The following xml is required if you want ,user be able to upload into maven repo., from its terminal or idea\non your project ```pom.xml``` add the following xml to let maven **UPLOAD** your project artifactory into the maven-repo \n```xml\n\u003cdistributionManagement\u003e\n    \u003csnapshotRepository\u003e\n        \u003cid\u003eYOUR_BUCKET_NAME-snapshot\u003c/id\u003e\n        \u003curl\u003es3://YOUR_BUCKET_NAME/snapshot\u003c/url\u003e\n    \u003c/snapshotRepository\u003e\n    \u003crepository\u003e\n        \u003cid\u003eYOUR_BUCKET_NAME-release\u003c/id\u003e\n        \u003curl\u003es3://YOUR_BUCKET_NAME/release\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/distributionManagement\u003e\n\n```\n\nAnd the most important one, add the following xml in your project ```pom.xml``` with in the ```\u003cbuild\u003e``` tag\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.ehsaniara/maven-repository-aws-s3/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.ehsaniara/maven-repository-aws-s3)\n\n```xml\n\u003cbuild\u003e\n...\n    \u003cextensions\u003e\n        \u003cextension\u003e\n            \u003cgroupId\u003ecom.github.ehsaniara\u003c/groupId\u003e\n            \u003cartifactId\u003emaven-repository-aws-s3\u003c/artifactId\u003e\n            \u003cversion\u003e1.2.11\u003c/version\u003e\n        \u003c/extension\u003e\n    \u003c/extensions\u003e\n...\n\u003c/build\u003e\n```\n\nfor Example:\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.ehsaniara/maven-repository-aws-s3/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.ehsaniara/maven-repository-aws-s3)\n\n```xml\n\u003cbuild\u003e\n    \u003cplugins\u003e\n        \u003cplugin\u003e\n            \u003cgroupId\u003eorg.springframework.boot\u003c/groupId\u003e\n            \u003cartifactId\u003espring-boot-maven-plugin\u003c/artifactId\u003e\n            \u003cexecutions\u003e\n                \u003cexecution\u003e\n                    \u003cgoals\u003e\n                        \u003cgoal\u003ebuild-info\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-compiler-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e3.8.1\u003c/version\u003e\n            \u003cconfiguration\u003e\n                \u003crelease\u003e11\u003c/release\u003e\n            \u003c/configuration\u003e\n        \u003c/plugin\u003e\n    \u003c/plugins\u003e\n\n\n    \u003cextensions\u003e\n        \u003cextension\u003e\n            \u003cgroupId\u003ecom.github.ehsaniara\u003c/groupId\u003e\n            \u003cartifactId\u003emaven-repository-aws-s3\u003c/artifactId\u003e\n            \u003cversion\u003e1.2.11\u003c/version\u003e\n        \u003c/extension\u003e\n    \u003c/extensions\u003e\n    \n\u003c/build\u003e\n```\n\nonce you have setup your pom.xml file in your project you can run the following line:\n\n```shell script\n# to clean your target directory\nmvn clean\n# deploy your artifactory into you maven-repo (AWS S3 Bucket)\nmvn deploy\n```\n\n\n\u003ca name=\"CI-CD-Pipeline-Setup\"\u003e\u003c/a\u003e\n## CI/CD Pipeline Setup\n[updating soon..]\n\n\n\u003ca name=\"Reference\"\u003e\u003c/a\u003e\n## Reference\n\nApache wagon: http://maven.apache.org/wagon/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehsaniara%2Fmaven-repository-aws-s3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fehsaniara%2Fmaven-repository-aws-s3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fehsaniara%2Fmaven-repository-aws-s3/lists"}