Do not limit your challenges.. Challenge your limits

BTemplates.com

Search This Blog

Powered by Blogger.

About Me

My photo
kathmandu, Bagmati, Nepal
I am Software developer based on Nepal.I have started coding since mid of 1995 with QBasic.My interest in software development covers a broad range of technologies from assembly to the Microsoft .NET platform to Java, Linux to Windows, Windows Mobile to Android, desktop to web to mobile, and many others. But from 2007 I am just working on Java mainly working on Java EE platform and decided just to go with it. I really like to learn new stuff and share things with others which is my main objective in creating this blog.

ArchUnit : Java architecture test library

Finally I have found the required library which will enforce architecture patterns . ArchUnit  . Currently I am exploring it and will upd...

Friday, July 26, 2013

Github as maven repository


We can use github as personal maven repository so that we can share code/lib among other projects
  1. Create new repository in github (say hello-world)
  2. clone it ( using ide or using command )
  3. create root directory for maven repository in the same cloned local git directory
  4. add following lines in pom.xml
  5.     <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>
    
  6. execute below command 
  7. mvn -DperformRelease=true clean deploy
    
    
  8. add files to git
  9. git add .
    
    
  10. Commit the changes
  11. git commit -m "release deploying"
    
  12. push change to remote server
  13. git push origin master
    
  14. Add repository url in another project where you to have dependency of just deployed project
  15. <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>
    
  16. add dependency as 
  17. <dependency>
      <groupId>net.surajchhetry.hello</groupId>
      <artifactId>hello-world</artifactId>
      <version>0.1</version>            
    </dependency>
    
Happy Sharing....

0 comments:

Post a Comment