I want to create local maven repository. I did the following steps:
- Installed maven plugin in eclipse
- Created one folder localrepository in apache server which is accessible using http://< my-domain>/localrepository
In my project pom.xml I have provided
<repositories> <repository> <id>repository</id> <url>http://<my-domain>/localMavenRepository</url> </repository> </repositories>
But it is not resolving the jars which are on http://< my-domain>/localMavenRepository
Is there any need to provide repository?
I have to object Stanley, it should work this way. While the article Stanley links leads to way more powerful setups, if you need just a very basic simple repository, then just an Apache with the default configuration can do to provide a repository.
The key is that you need the correct folder structure and while the docs don't mention it so explicitly... It is the same structure as a local repository.
Add a file to your repository like this:
Assuming that the document root for example.com on your Apache is
/var/www/html/
that would cause "YOUR_JAR.jar" to be available for maven on a repository configured with<url>http://example.com/mavenRepository</url>
A different way is to include your jar into your local maven repository.
See here for a simple example.
You can't create a private repository that way. Check out this article: http://www.theserverside.com/news/1364121/Setting-Up-a-Maven-Repository.
I'm using Artifactory Open Source version.
If maven is not creating Local Repository i.e .m2/repository folder then try below step.
In your Eclipse\Spring Tool Suite, Go to Window->preferences-> maven->user settings-> click on Restore Defaults-> Apply->Apply and close
Yes you can! For a simple repository that only publish/retrieve artifacts, you can use nginx.
Make sure nginx has http dav module enabled, it should, but nonetheless verify it.
Configure nginx http dav module:
In Windows: d:\servers\nginx\nginx.conf
In Linux (Ubuntu): /etc/nginx/sites-available/default
Don't forget to give permissions to the directory where the repo will be located:
sudo chmod +777 /var/www/html/repository
In your project's
pom.xml
add the respective configuration:Retrieve artifacts:
Publish artifacts:
To publish artifacts use
mvn deploy
. To retrieve artifacts, maven will do it automatically.And there you have it a simple maven repo.