Maven workspace local repository?

Maven can search multiple repositories (local, remote, "fake" remote) to resolve dependencies but there is only ONE local repository where artifacts get installed during install It would be a real nightmare to install artifacts into specific locations and to maintain this list without breaking anything, that would just not work, you don't want to do this.

Maven can search multiple repositories (local, remote, "fake" remote) to resolve dependencies but there is only ONE local repository where artifacts get installed during install. It would be a real nightmare to install artifacts into specific locations and to maintain this list without breaking anything, that would just not work, you don't want to do this. But, TBH, I don't get the point.So, why the hell do you want to do this?

There might be alternative and much simpler solutions, like installing your artifacts in the local repository and then copying them under your project root. Why wouldn't this work? I'd really like to know the final intention though.

UPDATE: Having read the update of the initial question, the only solution I can think of (given that you don't want to use different versions/tags) would be to use two local repositories and to switch between them (very error prone though). To do so, either use different user accounts (as the local repository is user specific by default). Or update your ~/.

M2/settings. Xml each time you want to switch: ${user. Home}/.

M2/repository ... Or have another settings. Xml and point on it using the --settings option: mvn install --settings /path/to/alternate/settings. Xml Or specify the alternate location on the command line using the -Dmaven.repo.

Local option: mvn -Dmaven.repo. Local=/path/to/repo These solutions are all error prone as I said and none of them is very satisfying. Even if you might have very good reasons to work on several branches in parallel, your use case (not rebuilding everything) is not very common.

Here, using distinct user accounts migh be the less worse solution IMO.

I didn't ask how I can install to multiple repositories and my example shows the files are installed in one repository (/work/project/repository). How do I tell maven to search for multiple repositories on local disk? I know of the "fake" remote repository technique, but this causes maven to copy the files from the fake remote to the local repository.

– IttayD Jan 7 '10 at 14:15 Well, this may not be what you asked for but this is what you are trying to do and, in your example, there are indeed 2 local repositories: /work/project/repository and ~/. M2/repository. But this is not possible, there is only ONE local repository (wherever it's located).

Please clarify what you are trying to achieve and your needs. As I said, I don't get the whole thing. – Pascal Thivent Jan 7 '10 at 14:21 added my intention – IttayD Jan 9 '10 at 18:44 thanks for the effort.In both cases, the local repository will also be populated with all 3rd party artifacts, wasting disk space.

Marking as a solution since it probably doesn't get any better – IttayD Jan 10 '10 at 5:16.

This is not possible with the command line client but you can create more complex repository layouts with a Maven repository server like Nexus. The reason why it's not possible is that Maven allows to nest projects and most of them will reference each other, so installing each artifact in a different repository would lead to lots of searches on your local hard disk (or to failed builds when you start a build in a sub-project).

You're describing how to create a remote composite repository. I'm looking for something similar, but for a local repository. (search in different folders, install into one) – IttayD Jan 7 '10 at 14:16 Install Nexus on your local computer to get this beha It's not possible to achieve with Maven alone.

– Aaron Digulla Jan 7 '10 at 14:48 even with nexus, I will still need a local repository where maven will download all 3rd party artifacts. – IttayD Jan 7 '10 at 19:41 There is no way to keep the local repository clean. – Aaron Digulla Jan 8 '10 at 8:11 btw, about the reason, I don't see why this is a problem.

I simply want to be able to specify 2 local repositories that are searched where one is designated as the 'install-to' repository and the other as the 'download-to' repository. If I have several projects where each has a different 'install-to' repository, then this is a configuration problem I need to fix. – IttayD Jan 8 '10 at 19:03.

I think that what you're looking for is the dependency:copy-dependencies goal See: maven.apache.org/plugins/maven-dependenc... This is often performed as a prelude to building an installable package, or if you want to invoke a third-party tool that will build a classpath from all jars in a specified directory.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions