Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forcing Maven2 to download source jars to local repository

I have my company dependencies (including non-FOSS third party stuff) in a Nexus repository, including source jars (downloaded with mvn dependency:resolve), where available.

I would like to have the source jars (and javadoc jars) download to my local repository (~/.m2/repository) so that I can go "offline".

I tried various combinations of mvn dependency:resolve dependency:go-offline -Dclassifier=sources, but it does not seem to copy them to my local repository.

Thanks.

like image 941
Ralph Avatar asked Nov 12 '10 15:11

Ralph


People also ask

How do I force maven to download dependencies from local repository?

We can use -U/--update-snapshots flag when building a maven project to force maven to download dependencies from the remote repository. Here, -U,--update-snapshots : Forces a check for missing releases and updated snapshots on remote repositories.

Why maven try to download locally exist jars?

For some reason it could be that the jar is found there, but the pom is not. If this is not the case, you have some kind of mismatch between the local repository when maven runs and when you install the jar from console, but I can't figure out how. yes problem jregex-1.2_01.


1 Answers

Did you try:

mvn dependency:sources
like image 84
Pascal Thivent Avatar answered Oct 13 '22 03:10

Pascal Thivent