0

I know, by default, with maven dependencies, it will grab everything it needs from the local repo (.m2 directory). In my application, I don't want it to depend from the local directory, but from a specific location. I've used the <scope>system</scope> with <systemPath>../path/to/file/</systemPath>, but it still depends from the .m2 directory. Is there anyway I can change where the maven dependencies depend from?

With my application, I'm using the native code (C++) and there are .nar and .so files. In this example, I specifically need to depend on a .so file in a specific directory, but it's always going to the .m2 directory. Is there a plugin that could fix this?

Also, to note that I'm using Maven 2.2.1.

Rob Avery IV
  • 3,562
  • 10
  • 48
  • 72

1 Answers1

1

First there is nothing to fix in Maven. Maven is working that way. In your case you need an artifact which is not within a maven repository that means you need to transfer that file into a maven repository and afterwards you can use simply dependencies to use that file (.so). There are two possible solutions:

Using the install-file to install that particular file into your local repository as an artifact by giving groupId, artifactId and version

mvn install:install-file ...

The other and best solution is to use a repository manager and install the needed files into the repository manager which makes it possible being used by other people as well and not only by you.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
  • There's no way to overwrite the dependency directory from the local repo to a custom path? – Rob Avery IV Feb 01 '13 at 18:51
  • @Rob, there is a way to set the repo directory, but maven will simply download all the dependencies into that new location. If you have a dependency that is not normally available through maven central, you typically either install it manually as described, or give it system scope and specify the path to it. – John Haager Feb 02 '13 at 07:20