Reputation: 141
I have multiple projects. I want to create different maven repository paths for each project. Means, each project should point to different folder as maven repository (by default C:/Users/USERNAME/.m2 is used as repo). I know that this may increase the download and same files if used in multiple projects will be downloaded/kept multiple times. But i want to separate out the repository for different projects so that i can bundle the repository along with my project's source code to be shared to the other person. I simply dont want to share my whole m2 repository (of size 2 gb) for a very small project sized 50 mb.
Regards,
Vibhav
Upvotes: 10
Views: 7919
Reputation: 1
My solution using Eclipse and Maven is to create new workspace, maven repository and settings.xml replacing the default .m2 repository path.
Then, try in Eclipse: Preferences>User Settings and browse your settings.xml
replace the User Settings file
Upvotes: 0
Reputation: 141
Thanks everyone for your comments.
I finally did the following:
This way, I could get separate maven repositories for each project (or I should say workspace).
Thanks, Vibhav Agrawal
Upvotes: 2
Reputation: 77951
See the following answer:
Prevent Jenkins from Installing Artifact to Local Maven Repository
In a nutshell use a settings file for each build. Enables you to control both the local repository used for that project, but also other settings like repositories and build profiles.
Upvotes: 0
Reputation: 24722
You can specify repository location via command line option -Dmaven.repo.local=
I'd have just put a wrapper script to start maven in the project location and specified repository in it (probably pointing to location inside the project for your use case).
Upvotes: 4