Github as maven repository
We can use github as personal maven repository so that we can share code/lib among other projects
- Create new repository in github (say hello-world)
- clone it ( using ide or using command )
- create root directory for maven repository in the same cloned local git directory
- add following lines in pom.xml
- execute below command
- add files to git
- Commit the changes
- push change to remote server
- Add repository url in another project where you to have dependency of just deployed project
- add dependency as
<properties>
<github.maven.repository>file:///home/suraj/Desktop/workspace/hello-world/hello-world/releases/</github.maven.repository>
<github.maven.snapshots>file:///home/suraj/Desktop/workspace/hello-world/hello-world/snapshots/</github.maven.snapshots>
</properties>
<distributionManagement>
<repository>
<id>hello-world</id>
<url>${github.maven.repository}</url>
</repository>
<snapshotRepository>
<id>hello-world</id>
<url>${github.maven.snapshots}</url>
</snapshotRepository>
</distributionManagement>
mvn -DperformRelease=true clean deploy
git add .
git commit -m "release deploying"
git push origin master
<repositories>
<repository>
<id>hello-world</id>
<releases>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</releases>
<url>https://github.com/YOUR_USER_NAME/hello-world/raw/master/releases</url>
</repository>
</repositories>
<dependency>
<groupId>net.surajchhetry.hello</groupId>
<artifactId>hello-world</artifactId>
<version>0.1</version>
</dependency>
0 comments:
Post a Comment