Skip to content

Instantly share code, notes, and snippets.

@cleberjamaral
Last active July 19, 2025 07:30
Show Gist options
  • Select an option

  • Save cleberjamaral/6c9b0a615e51e26c94ffe407a641f531 to your computer and use it in GitHub Desktop.

Select an option

Save cleberjamaral/6c9b0a615e51e26c94ffe407a641f531 to your computer and use it in GitHub Desktop.

Revisions

  1. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -40,7 +40,6 @@ In this how-to it is being explained how to create a maven repository on github

    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.

    1. 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
    1. 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```

    1. To update your maven2 repo, follow steps from run mvn install for jar creation
  2. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -32,9 +32,7 @@ In this how-to it is being explained how to create a maven repository on github
    ```git push origin maven2```

    1. On gradle you can add this repository on 'repositories'
    ```bash
    maven { url "https://github.com/ORGANIZATION-NAME/PROJECT-NAME/raw/maven2" }
    ```
    ```maven { url "https://github.com/ORGANIZATION-NAME/PROJECT-NAME/raw/maven2" }```

    * *1 Your 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.

  3. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ In this how-to it is being explained how to create a maven repository on github
    ```rm -R ALL-PROJECT-SUB-FOLDERS```
    ```rm ALL-PROJECT-FILES```

    1. run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM). See * for details.
    1. run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM). See *1 for details.
    ```mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DlocalRepositoryPath=. -DcreateChecksum=true -DgeneratePom=true```

    1. Add all files to be commited
    @@ -36,7 +36,7 @@ In this how-to it is being explained how to create a maven repository on github
    maven { url "https://github.com/ORGANIZATION-NAME/PROJECT-NAME/raw/maven2" }
    ```
    * * Your 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.
    * *1 Your 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.
    ## Using an existing repository
  4. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -19,9 +19,8 @@ In this how-to it is being explained how to create a maven repository on github
    ```rm -R ALL-PROJECT-SUB-FOLDERS```
    ```rm ALL-PROJECT-FILES```

    1. run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM).
    1. run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM). See * for details.
    ```mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DlocalRepositoryPath=. -DcreateChecksum=true -DgeneratePom=true```
    1. Your 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.

    1. Add all files to be commited
    ```git add .```
    @@ -37,6 +36,8 @@ In this how-to it is being explained how to create a maven repository on github
    maven { url "https://github.com/ORGANIZATION-NAME/PROJECT-NAME/raw/maven2" }
    ```
    * * Your 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.
    ## Using an existing repository
    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.
  5. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ In this how-to it is being explained how to create a maven repository on github

    1. 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=true```
    * Your 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.
    1. Your 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.

    1. Add all files to be commited
    ```git add .```
  6. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -19,9 +19,10 @@ In this how-to it is being explained how to create a maven repository on github
    ```rm -R ALL-PROJECT-SUB-FOLDERS```
    ```rm ALL-PROJECT-FILES```

    1. run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM). Your 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.
    ```mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION \\ -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DlocalRepositoryPath=. -DcreateChecksum=true \\ -DgeneratePom=true```

    1. 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=true```
    * Your 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.

    1. Add all files to be commited
    ```git add .```

  7. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 2 additions and 4 deletions.
    6 changes: 2 additions & 4 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -20,10 +20,8 @@ In this how-to it is being explained how to create a maven repository on github
    ```rm ALL-PROJECT-FILES```

    1. run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM). Your 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.
    ```mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION \\
    -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DlocalRepositoryPath=. -DcreateChecksum=true \\
    -DgeneratePom=true
    ```
    ```mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION \\ -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DlocalRepositoryPath=. -DcreateChecksum=true \\ -DgeneratePom=true```

    1. Add all files to be commited
    ```git add .```

  8. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -20,8 +20,7 @@ In this how-to it is being explained how to create a maven repository on github
    ```rm ALL-PROJECT-FILES```

    1. run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM). Your 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.
    ```bash
    mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION \\
    ```mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION \\
    -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DlocalRepositoryPath=. -DcreateChecksum=true \\
    -DgeneratePom=true
    ```
  9. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 3 additions and 8 deletions.
    11 changes: 3 additions & 8 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -19,25 +19,20 @@ In this how-to it is being explained how to create a maven repository on github
    ```rm -R ALL-PROJECT-SUB-FOLDERS```
    ```rm ALL-PROJECT-FILES```

    1. run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM)
    1. run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM). Your 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.
    ```bash
    mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION \\
    -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DlocalRepositoryPath=. -DcreateChecksum=true \\
    -DgeneratePom=true
    ```
    Your 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

    ```
    1. Add all files to be commited
    ```git add .```

    1. Commit these changes
    ```git commit -m "Released version ARTIFACT-VERSION"```

    1. Push this commit
    1. Push this commit. After that your maven structure for you project can be reached by github raw data address https://github.com/GROUP-NAME/PROJECT-NAME/raw/maven2
    ```git push origin maven2```

    Now maven structure for you project can be reached by github raw data address https://github.com/GROUP-NAME/PROJECT-NAME/raw/maven2

    1. On gradle you can add this repository on 'repositories'
    ```bash
  10. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 3 additions and 7 deletions.
    10 changes: 3 additions & 7 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -4,9 +4,7 @@ In this how-to it is being explained how to create a maven repository on github

    ## Creating a repository

    1. 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```
    1. 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```

    1. Go to the clonned repository (use your PROJECT-NAME-maven2)
    ```cd PROJECT-NAME-maven2```
    @@ -18,10 +16,8 @@ In this how-to it is being explained how to create a maven repository on github
    ```git checkout maven2```

    1. Remove project original files, this branch is just for releases
    ```
    rm -R ALL-PROJECT-SUB-FOLDERS
    rm ALL-PROJECT-FILES
    ```
    ```rm -R ALL-PROJECT-SUB-FOLDERS```
    ```rm ALL-PROJECT-FILES```

    1. run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM)
    ```bash
  11. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 20 additions and 19 deletions.
    39 changes: 20 additions & 19 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -2,26 +2,28 @@

    In this how-to it is being explained how to create a maven repository on github and how to use an existing one.

    ## Creating a repository
    ## Creating a repository

    1. 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```
    ```git clone https://github.com/GROUP-NAME/PROJECT-NAME.git PROJECT-NAME-maven2```

    1. Go to the clonned repository (use your PROJECT-NAME-maven2)
    cd PROJECT-NAME-maven2
    ```cd PROJECT-NAME-maven2```

    1. Create a branch for maven files
    git branch maven2
    ```git branch maven2```

    ### Switch to this new branch
    git checkout maven2
    1. Switch to this new branch
    ```git checkout maven2```

    ### Remove project original files, this branch is just for releases
    1. Remove project original files, this branch is just for releases
    ```
    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)
    1. run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM)
    ```bash
    mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION \\
    -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DlocalRepositoryPath=. -DcreateChecksum=true \\
    @@ -30,19 +32,18 @@ mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=AR
    Your 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

    ### Add all files to be commited
    git add .
    1. Add all files to be commited
    ```git add .```

    ### Commit these changes
    git commit -m "Released version ARTIFACT-VERSION"
    1. Commit these changes
    ```git commit -m "Released version ARTIFACT-VERSION"```

    ### Push this commit
    git push origin maven2
    1. Push this commit
    ```git push origin maven2```

    ### Now maven structure for you project can be reached by github raw data address
    https://github.com/GROUP-NAME/PROJECT-NAME/raw/maven2
    Now maven structure for you project can be reached by github raw data address https://github.com/GROUP-NAME/PROJECT-NAME/raw/maven2

    ### On gradle you can add this repository on 'repositories'
    1. On gradle you can add this repository on 'repositories'
    ```bash
    maven { url "https://github.com/ORGANIZATION-NAME/PROJECT-NAME/raw/maven2" }
    ```
    @@ -51,7 +52,7 @@ 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)
    1. 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
    ### To update your maven2 repo, follow steps from run mvn install for jar creation
    1. To update your maven2 repo, follow steps from run mvn install for jar creation
  12. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@ In this how-to it is being explained how to create a maven repository on github
    ## Creating a repository

    1. 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```

    1. Go to the clonned repository (use your PROJECT-NAME-maven2)
  13. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ In this how-to it is being explained how to create a maven repository on github
    ## Creating a repository

    1. 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
    ```git clone https://github.com/GROUP-NAME/PROJECT-NAME.git PROJECT-NAME-maven2```

    1. Go to the clonned repository (use your PROJECT-NAME-maven2)
    cd PROJECT-NAME-maven2
  14. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -6,9 +6,10 @@ In this how-to it is being explained how to create a maven repository on github

    1. 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

    1. Go to the clonned repository (use your PROJECT-NAME-maven2)
    cd PROJECT-NAME-maven2

    1. Create a branch for maven files
    git branch maven2

  15. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 3 additions and 4 deletions.
    7 changes: 3 additions & 4 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -4,13 +4,12 @@ In this how-to it is being explained how to create a maven repository on github

    ## Creating a repository

    ### Clone your original project to a new local repository (change GROUP-NAME and PROJECT-NAME)
    1. 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)
    1. Go to the clonned repository (use your PROJECT-NAME-maven2)
    cd PROJECT-NAME-maven2

    ### Create a branch for maven files
    1. Create a branch for maven files
    git branch maven2

    ### Switch to this new branch
  16. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -2,16 +2,16 @@

    In this how-to it is being explained how to create a maven repository on github and how to use an existing one.

    ## Creating a repository
    ## Creating a repository

    ### 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
    ### 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
    ### Go to the clonned repository (use your PROJECT-NAME-maven2)
    cd PROJECT-NAME-maven2

    ### Create a branch for maven files
    git branch maven2
    ### Create a branch for maven files
    git branch maven2

    ### Switch to this new branch
    git checkout maven2
  17. cleberjamaral revised this gist Oct 7, 2019. 1 changed file with 32 additions and 17 deletions.
    49 changes: 32 additions & 17 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -1,41 +1,56 @@
    # How to use github as a maven repository

    ## Clone your original project to a new local repository (change ORGANIZATION-NAME and PROJECT-NAME)
    git clone https://github.com/ORGANIZATION-NAME/PROJECT-NAME.git PROJECT-NAME-maven2
    In this how-to it is being explained how to create a maven repository on github and how to use an existing one.

    ## Creating a repository

    ### 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)
    ### Go to the clonned repository (use your PROJECT-NAME-maven2)
    cd PROJECT-NAME-maven2

    ## Create a branch for maven files
    ### Create a branch for maven files
    git branch maven2

    ## Switch to this new branch
    ### Switch to this new branch
    git checkout maven2

    ## Remove project original files, this branch is just for releases
    rm -R ALL-PROJECT-FILES
    ### Remove project original files, this branch is just for releases
    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)
    ### run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM)
    ```bash
    mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION \\
    -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DlocalRepositoryPath=. -DcreateChecksum=true \\
    -DpomFile=PATH-TO-EXISTING-POM
    -DgeneratePom=true
    ```
    Use -DgeneratePom=true instead of -DpomFile=PATH-TO-EXISTING-POM to create POM
    Your 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

    ## Add all files to be commited
    ### Add all files to be commited
    git add .

    ## Commit these changes
    ### Commit these changes
    git commit -m "Released version ARTIFACT-VERSION"

    ## Push this commit
    ### Push this commit
    git push origin maven2

    ## Now maven structure for you project can be reached by github raw data address
    https://github.com/ORGANIZATION-NAME/PROJECT-NAME/raw/maven2
    ### Now maven structure for you project can be reached by github raw data address
    https://github.com/GROUP-NAME/PROJECT-NAME/raw/maven2

    ## On gradle you can add this repository on 'repositories'
    ### On gradle you can add this repository on 'repositories'
    ```bash
    maven { url "https://github.com/ORGANIZATION-NAME/PROJECT-NAME/raw/maven2" }
    ```
    ```
    ## Using an existing repository
    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
    ### To update your maven2 repo, follow steps from run mvn install for jar creation
  18. cleberjamaral revised this gist Oct 30, 2018. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -18,9 +18,10 @@ rm -R ALL-PROJECT-FILES
    ## run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM)
    ```bash
    mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION \\
    -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DpomFile=PATH-TO-EXISTING-POM -DlocalRepositoryPath=. \\
    -DcreateChecksum=true
    -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DlocalRepositoryPath=. -DcreateChecksum=true \\
    -DpomFile=PATH-TO-EXISTING-POM
    ```
    Use -DgeneratePom=true instead of -DpomFile=PATH-TO-EXISTING-POM to create POM

    ## Add all files to be commited
    git add .
  19. cleberjamaral revised this gist Oct 29, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,9 @@ rm -R ALL-PROJECT-FILES

    ## run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM)
    ```bash
    mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DpomFile=PATH-TO-EXISTING-POM -DlocalRepositoryPath=. -DcreateChecksum=true
    mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION \\
    -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DpomFile=PATH-TO-EXISTING-POM -DlocalRepositoryPath=. \\
    -DcreateChecksum=true
    ```

    ## Add all files to be commited
  20. cleberjamaral revised this gist Oct 29, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -15,9 +15,9 @@ git checkout maven2
    ## Remove project original files, this branch is just for releases
    rm -R ALL-PROJECT-FILES

    ## run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION and PATH-TO-THE-JAR)
    ## run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION, PATH-TO-THE-JAR and PATH-TO-EXISTING-POM)
    ```bash
    mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DgeneratePom=true -DlocalRepositoryPath=. -DcreateChecksum=true
    mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DpomFile=PATH-TO-EXISTING-POM -DlocalRepositoryPath=. -DcreateChecksum=true
    ```

    ## Add all files to be commited
  21. cleberjamaral revised this gist Oct 26, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ git branch maven2
    git checkout maven2

    ## Remove project original files, this branch is just for releases
    rm -R <ALL-PROJECT-FILES>
    rm -R ALL-PROJECT-FILES

    ## run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION and PATH-TO-THE-JAR)
    ```bash
  22. cleberjamaral created this gist Oct 26, 2018.
    38 changes: 38 additions & 0 deletions how-to-use-github-as-maven-repo.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    # How to use github as a maven repository

    ## Clone your original project to a new local repository (change ORGANIZATION-NAME and PROJECT-NAME)
    git clone https://github.com/ORGANIZATION-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

    ## Switch to this new branch
    git checkout maven2

    ## Remove project original files, this branch is just for releases
    rm -R <ALL-PROJECT-FILES>

    ## run mvn install for jar creation (change GROUP, ARTIFACT-NAME, ARTIFACT-VERSION and PATH-TO-THE-JAR)
    ```bash
    mvn install:install-file -DgroupId=GROUP -DartifactId=ARTIFACT-NAME -Dversion=ARTIFACT-VERSION -Dfile=PATH-TO-THE-JAR -Dpackaging=jar -DgeneratePom=true -DlocalRepositoryPath=. -DcreateChecksum=true
    ```

    ## Add all files to be commited
    git add .

    ## Commit these changes
    git commit -m "Released version ARTIFACT-VERSION"

    ## Push this commit
    git push origin maven2

    ## Now maven structure for you project can be reached by github raw data address
    https://github.com/ORGANIZATION-NAME/PROJECT-NAME/raw/maven2

    ## On gradle you can add this repository on 'repositories'
    ```bash
    maven { url "https://github.com/ORGANIZATION-NAME/PROJECT-NAME/raw/maven2" }
    ```