I have a project, that has pom.xml
and depends on lots of dependencies from outside (located far-far in internet..).
So, I want to download all those dependencies which I depend on to my "local repository".
This is my try (I do not need do compilation, so I use "validate" here. So I'm do not expect to have "target" folder in the end):
mvn validate -Dmaven.repo.local=C:\my\.m2\repository dependency:copy-dependencies
In the end - yes I have many dependencies been downloaded to "C:\my\.m2\repository"
, but some of them went to: C:\projects\myProject\java\trunk\target\dependency
, like these ones:
junit-4.8.1.jar
log4j-1.2.8.jar
mockito-all-1.8.2.jar
Question is: how to make those to be downloaded to "C:\my\.m2\repository"
but not to "target"
of my project?
For now, because of that, another projects that depend on that are failing while building, because they are expecting to find "junit-4.8.1.jar" in local repo.
Another try:
mvn validate -Dmaven.repo.local=C:\my\.m2\repository dependency:resolve
Then those dependencies are not resolvable at all.
Could not resolve dependencies for project bla-bla-SNAPSHOT: The following artifacts could not be resolved: commons-lang:commons-lang:jar:2.4, log4j:log4j:jar:1.2.8, junit:junit:jar:4.8.1: Could not find artifact commons-lang:commons-lang:jar:2.4 -> [Help 1]
Maven did that because you invoked the goal dependency:copy-dependencies. It will copy the dependencies of the current module to
See http://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html
I really can't imagine these dependencies did not get into your local repo. Fiddling around with a script may not be the solution to your problem. Try
The -U option forces a download of all dependencies. I suggest using
process-resources
, although as of my understandingvalidate
should be fine, too.