In this how-to it is being explained how to create a maven repository on github and how to use an existing one.
-
Clone your original project to a new local repository (change GROUP-NAME and PROJECT-NAME) git clone https://github.com/GROUP-NAME/PROJECT-NAME.git PROJECT-NAME-maven2
-
Go to the clonned repository (use your PROJECT-NAME-maven2) cd PROJECT-NAME-maven2
-
Create a branch for maven files git branch maven2
git checkout maven2
rm -R ALL-PROJECT-SUB-FOLDERS rm ALL-PROJECT-FILES
run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM)
mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION \\
-Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DlocalRepositoryPath=. -DcreateChecksum=true \\
-DgeneratePom=trueYour PATH-TO-THE-JAR will be something like: ../PROJECT-NAME/build/libs/ARTIFACT-NAME-ARTIFACT-VERSION.jar Use -DpomFile=PATH-TO-EXISTING-POM instead of -DgeneratePom=true if you already have a POM
git add .
git commit -m "Released version ARTIFACT-VERSION"
git push origin maven2
https://github.com/GROUP-NAME/PROJECT-NAME/raw/maven2
maven { url "https://github.com/ORGANIZATION-NAME/PROJECT-NAME/raw/maven2" }If you already have a repository using this way explained above, you can use the following commands to setup another machine in order to update your repository.
Clone your maven2 branch to a local folder which name is followed by "-maven2" (change GROUP-NAME and PROJECT-NAME)
git clone https://github.com/GROUP-NAME/PROJECT-NAME.git PROJECT-NAME-maven2 --branch maven2