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:
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/
When 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=true
Now 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.