How to install and use the latest library when it is not available in Maven repository

January 28 2007No Commented

Categorized Under: Software Engineer

Maven tool is great but the first time I use it, I have had some difficulties of managing dependencies in my project. I use hibernate 3.2 as the ORM framework in my project, but I only found hibernate 3.1beta as the latest version in Maven repository folder. More badly if I use Maven Eclipse plug-in the hibernate versions are available even more older.
That is my problem, I already have hibernate 3.2 on my machine but it is likely I must use the older version by downloading on remoting server (the bad news is that hibernate annotation tool uses java persistence api that can not be downloaded, that means I can not use hibernate annotations in my project!). I would like to use the latest library but unfortunately it is not available in Maven repository. That makes I need to create such one on my local repository. I have done two steps to solve that problem:

  1. Open the console and tell Maven install the library: mvn install:install-file -Dfile='path of library' -DgroupId='group id of library' -DartifactId='artifact id of library' -Dversion='version' -Dpackaging=jarMore specific example in case I installed hibernate library mvn install:install-file -Dfile=lib/hibernate/hibernate-annotations.jar -DgroupId=hibernate -DartifactId=hibernate-annotations -Dversion=3.2 -Dpackaging=jarMaven has installed your library to local repository. Check it in your local repository folder, in my case I checked at %MY_HOME_DIR%\.m2\repository\${group.id}\${artifact.id}\${version}(c:\Documents and Settings\hpnguyen\.m2\repository\hibernate\hibernate-annotations\3.2\)
  2. You need to create a pom file for your library. Open your local repository and create the corresponding pom file for your library. In my case, I created pom file name hibernate-annotations-3.2.pom and located it in %MY_HOME_DIR%\.m2\repository\hibernate\hibernate-annotations\3.2\, the content if pom file is here
    <project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>hibernate</groupId>
    <artifactId>hibernate-annotations</artifactId>
    <version>3.2</version>
    <dependencies>
    <dependency>
    <groupId>javax.persistence</groupId>
    <artifactId>ejb</artifactId>
    <version>3.0-public_review</version>
    </dependency>
    </dependencies>
    </project>

After finish this two step, you can use your latest library that is not listed in Maven repository.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • BarraPunto
  • Bitacoras.com
  • blinkbits
  • BlinkList
  • blogmarks
  • BlogMemes
  • BlogMemes Cn
  • BlogMemes Fr
  • BlogMemes Jp
  • BlogMemes Sp
  • Blogosphere News
  • Blogsvine
  • blogtercimlap
  • Book.mark.hu
  • Bumpzee
  • co.mments
  • connotea
  • De.lirio.us
  • Design Float
  • DotNetKicks
  • DZone
  • eKudos
  • email
  • Fark
  • Faves
  • feedmelinks
  • Fleck
  • Furl
  • GeenRedactie
  • Global Grind
  • Gwar
  • Haohao
  • HealthRanker
  • Hemidemi
  • Identi.ca
  • IndianPad
  • Internetmedia
  • kick.ie
  • Kirtsy
  • laaik.it
  • Leonaut
  • LinkaGoGo
  • LinkArena
  • LinkedIn
  • Linkter
  • Live
  • Ma.gnolia
  • Meneame
  • MisterWong
  • MisterWong.DE
  • muti
  • MyShare
  • MySpace
  • N4G
  • Netvibes
  • Netvouz
  • NewsVine
  • NuJIJ
  • Ping.fm
  • PlugIM
  • Pownce
  • ppnow
  • Print
  • Propeller
  • Ratimarks
  • Rec6
  • Reddit
  • SalesMarks
  • Scoopeo
  • scuttle
  • Segnalo
  • Shadows
  • Simpy
  • Slashdot
  • Smarking
  • Socialogs
  • SphereIt
  • Spurl
  • StumbleUpon
  • Symbaloo
  • Taggly
  • TailRank
  • Technorati
  • ThisNext
  • Tipd
  • Tumblr
  • TwitThis
  • Upnews
  • Webnews.de
  • Webride
  • Wikio
  • Wikio FR
  • Wikio IT
  • Wists
  • Wykop
  • Xerpi
  • Yahoo! Buzz
  • YahooMyWeb
  • Yigg

Leave a Reply