0

I am trying to export to the dependencies of my project using:

mvn dependency:copy-dependencies -Dmdep.useRepositoryLayout=true -DoutputDirectory=c:\output

The result of this is a subset of my local maven repository containing some jars that only I have on my machine.

I am trying to SHARE this subset of my local repository with my colleague.

All I want is to send this folder structure so he can import it to this own local maven maven repository.

We tried to copy these folders in his own local repository knowing this won't work.

My question is there any way to tell maven to "index" these files that were copied in the directory?

There are descriptors next to these files and inside the META-INF folders that makes me believe that group-ids, artifact-ids and version could be resolved.

Is there a solution or a workaround for this?

We could use mvn install:install-file for each individual jar, but there is too many.

Thank you very much, Peter

Peter Jaloveczki
  • 2,039
  • 1
  • 19
  • 35
  • Why not building on it's own...why do you need to share something? Downloads are done automatically ? Furthermore as already suggested if you are doing something in a corporate environment a repository manager is a must also for things like NPM, Docker Images etc. also for further improvements to a CI solution like Jenkins etc. – khmarbaise Mar 25 '20 at 14:22

2 Answers2

0

So, there two solutions to your problem:

  1. The real and standard solutions to share jars inside a company is to set up a Nexus or Artifactory server where you deploy your build artifacts to and which your colleague uses. Actually, if you develop with Maven with more than two people in a company, I would always set up a Nexus/Artifactory. They are for free and easy to use.

  2. If you really want to go forward with your approach, you can give the whole directory to your colleague. Then you can put this directory as a repository into the settings.xml and use it. Repositories can be local directories, they need not be remote repositories. See e.g. this answer https://stackoverflow.com/a/28762617/927493

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
-1

If you want a quick workaround, then you can make a copy of your entire repository and then remove the elements that you don't want to include. Compress the whole repository folder, pay special attention to include all the hidden files and send it.

This way you will include not only the metainfos that are in the jar folders, but also other metainfos that are spreaded in other folders inside the repo.

Your colleague will need to use that repository instead of their own (althought I would make a backup until doublecheck everything works ok). This way should work. The dependencies he had in it's own repo should be downloaded automatically again if needed, as long as he have access to remote repos.

user1039663
  • 1,230
  • 1
  • 9
  • 15