Recently, I came across an issue while running build for Maven pom.xml. I am using Hibernate Shards project in my product, and updated pom.xml with following:<dependency><groupId>hibernate</groupId><artifactId>shards</artifactId><version>3.0.0B2</version></dependency>Though when I ran the pom.xml with the above xml snippet, it was not able to find the hibernate shards jar file in the Maven repository and could not download it.I searched the Maven repository for hibernate shards file, but could not find it. Maven repository is available here - http://mvnrepository.com/SolutionWhen a pom.xml file is run using “mvn install” command, as part of the build, Maven fetches the jar files from the Maven repository on the internet. These jar files are stored under a folder called “.m2” under the users folder.In this case, since the Hibernate Shards file is not available in the Maven repository, we have to manually run Maven command to install this jar file under the “.m2” folder. So here’s the command,mvn install:install-file -Dfile=c:\Downloads\hibernate-shards-3.0.0.beta2.jar -DgroupId=hibernate -DartifactId=shards -Dversion=3.0.0B2 -Dpackaging=jar -DgeneratePom=trueNow when the pom.xml build file is run with “mvn install” command, the build runs successfully, since the local “.m2” folder repository is checked for hibernate shards jar file.http://itsitspace.blogspot.com/2011/03/manage-local-maven-dependency.html
- Posted by: Tejas Bavishi
- Posted on: April 01 2011 08:48 EDT
- that's easy by peter lin on April 01 2011 09:10 EDT
- Host a Maven Repository by Christian Herold on April 01 2011 10:08 EDT
- maven 101 by Andres F. on April 01 2011 11:00 EDT
- Manage Local Maven Dependency by Stefano Fornari on April 03 2011 11:35 EDT
just delete all the poms and get rid maven.
I am not sure whether we should discuss this Maven issue in this newsletter.
Your proposed solution will have the downside that the build isn't reproducable on another machine.
You should think about hosting an own repository like Nexus.
There you should deploy these artifacts which aren't accessible on public repos.
Right. And deploying to a maven repository (as opposed to your local repo) is explained here: http://maven.apache.org/plugins/maven-deploy-plugin/usage.html
(also part of the core documentation)
Yes it is!
Why don't use a repository manager like Nexus or Artifactory or Archiva?
There are many advanteges in using an Artifactory (or Nexus or Archiva) repository!
The first one is to save your pom file from defining tons of external repository links:
you can publish the configuration file used with Artifactory or Nexus (i.e. it merely contains the collection of all the external repository links) and remove them from your pom file, in this way you clean your pom file from the external resources.
Another advantage is: caching actifacts in a browsable site that could be easly backuped..etc..etc...
Thus, use one of the available maven repository managers!
Moreover the procedure illustrated in the post is the trivial one, should not be used for large (and serious) projects.
This is hardly an obscure Maven feature, but one of the core plugins described in http://maven.apache.org/plugins/maven-install-plugin/usage.html
Just remember to RTFM ;)
It looks like you should just add thr right repository to your pom: http://www.mvnbrowser.com/artifact-details.html?groupId=hibernate&artifactId=shards