├── .gitignore ├── README.md ├── deploySnapshot.sh ├── deployVersion.sh └── index.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Mac OS X 2 | .DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | visit project documentation at http://pangratz.github.com/maven-github-repository-instructions/ -------------------------------------------------------------------------------- /deploySnapshot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mvn clean deploy -P deploy-snapshot 3 | git checkout gh-pages 4 | git add . 5 | git commit -m "added new snapshot files" 6 | git push 7 | git checkout master -------------------------------------------------------------------------------- /deployVersion.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mvn release:clean release:prepare 3 | mvn release:perform 4 | git checkout gh-pages 5 | git add . 6 | git commit -m "added new version files" 7 | git push 8 | git checkout master -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Instructions for a Maven Project with a built in Maven Repository hosted on GitHub 3 | layout: default 4 | --- 5 | 6 | # Instructions for a Maven Project with a built in Maven Repository hosted on GitHub 7 | 8 | This template configures your Maven project so your builds (snapshots and releases) are deployed to 9 | a Maven Repository hosted inside the GitHub repository of the project. The Maven Repository makes use 10 | of the neat GitHub pages feature, and therefore the binaries are located in the `gh-pages` branch of your project. 11 | 12 | This project is heavily inspired by [this](http://cemerick.com/2010/08/24/hosting-maven-repos-on-github/) blog post from Chas Emerick. 13 | 14 | ## Modify the contents of your projects' pom.xml 15 | 16 | 1. add the following properties and fill in your GitHub username and the name of the project on GitHub 17 | 18 | 19 | ... 20 | YOUR_GIT_USERNAME 21 | YOUR_PROJECT_NAME_ON_GITHUB 22 | scm:git:git@github.com:${gitUser}/${gitProject}.git 23 | release-repo::default::file:../../repository/releases 24 | ... 25 | 26 | 27 | 2. add `scm` information 28 | 29 | 30 | ${scmUrl} 31 | ${scmUrl} 32 | ${scmUrl} 33 | 34 | 35 | 3. add a `deploy-snapshot` profile 36 | 37 | 38 | ... 39 | 40 | deploy-snapshot 41 | 42 | snapshot-repo::default::file:repository/snapshots 43 | 44 | 45 | ... 46 | 47 | 48 | 4. download the scripts [deploySnapshot.sh](deploySnapshot.sh) and [deployVersion.sh](deployVersion.sh) into the root folder of your Maven project 49 | 50 | 51 | ## Release a new version or snapshot 52 | 53 | execute either 54 | 55 | ./deploySnapshot.sh 56 | 57 | or 58 | 59 | ./deploySnapshot.sh 60 | 61 | 62 | ## Use the project files as dependency in other Maven projects 63 | 64 | add your projects' maven repository and replace `YOUR_GITHUB_USER_NAME` with your, you guessed it, GitHub user 65 | name and `YOUR_PROJECT_NAME_ON_GITHUB` with the name of the project on GitHub. 66 | 67 | 68 | ... 69 | 70 | YOUR_GITHUB_USER_NAME-mvn-repo-releases 71 | http://YOUR_GITHUB_USER_NAME.github.com/YOUR_PROJECT_NAME_ON_GITHUB/releases 72 | 73 | 74 | 75 | YOUR_GITHUB_USER_NAME-mvn-repo-snapshots 76 | http://YOUR_GITHUB_USER_NAME.github.com/YOUR_PROJECT_NAME_ON_GITHUB/snapshots 77 | 78 | ... 79 | 80 | 81 | 82 | now you can add your previous released project as a dependency 83 | 84 | 85 | ... 86 | 87 | ... 88 | ... 89 | ... 90 | 91 | ... 92 | 93 | 94 | 95 | 96 | 97 | --------------------------------------------------------------------------------