0

We are using our git server for project management. How do I download maven project dependency from my git server? For project checkout/pull and push we are using tortoise git

Clarification:

  • We are using another project as a submodule in our project. That project available on our local git server. So, when the new update is available I have to download and copy in m2 repository manual. Instead of a manual process, I want to download from my local git server.
Hkachhia
  • 4,463
  • 6
  • 41
  • 76
  • 1
    Question is not clear. Please try to elaborate it little more. And for pull push I would recommend to use commands. It is easier. And if you want to download, please copy the url and then use git clone URL to clone the project into your local workspace. – Pawan Tiwari Apr 04 '19 at 10:59
  • Possible duplicate of [Loading Maven dependencies from GitHub](https://stackoverflow.com/questions/20161602/loading-maven-dependencies-from-github) – Mebin Joe Apr 04 '19 at 11:00
  • Git is not a maven repository – Gyro Gearless Apr 04 '19 at 11:03
  • @MebinJoe: I have mentioned in my question that we are using our local git server so it's not related to GitHub then how it is duplicate? – Hkachhia Apr 04 '19 at 11:44
  • Different things are not clear to me: Do you store the jar in git or just the source code? Do you use the other project as module in a multi-module build or just as dependency? – J Fabian Meier Apr 04 '19 at 11:58
  • Yes, jar stored on the server. We use this project APIs in our project. We have another submodules but it's part of our project – Hkachhia Apr 04 '19 at 12:05
  • 2
    Looks like you are more in need of a repository manager like Nexus: https://www.sonatype.com/nexus-repository-oss – Joachim Rohde Apr 04 '19 at 12:29

1 Answers1

2

Storing jar artifacts in git is a bad idea. Git is not meant for binary files. Use a maven repository server like Nexus or Artifactory instead.

EDIT: I admit that this answer lacks background and explanation. So I added a little.

  1. Most sources I know do not recommend to put (large) binaries into git repositories because checking out the git repository means checking out all old versions of the binaries and that might be a lot of stuff.
  2. There are specialised solutions (Maven repositories like Nexus/Artifactory) for the task at hand which can be directly used by Maven without giving URLs to separate artifacts (the URL of the repository suffices to find all artifacts in it).
  3. AFAIK GitHub and GitLab offer services to provide Java artifacts as Maven repositories. So if you use on of these services, you probably have cheap other option.
J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
  • I don't like your answer because does not provide any argument, apart from "is a bad idea", "is not meant for". It is like "we always did like that", which is really a negative approach in every science. Apart from that, storing the distribution binary in a git repository would be an amazing idea in my opinion, since you could have a single, universal method to distribute the binary along with its source (a npm package, a maven artifact, you name it). Npm already allows you to add a dependency directly from a git URL, the same should do Maven and so the others. – Luca Fagioli Mar 30 '20 at 08:24
  • 1
    Ok, I admit that my answer lacks explanation. So: 1. Most sources I know do not recommend to put (large) binaries into git repositories because checking out the git repository means checking out _all_ old versions of the binaries and that might be a lot of stuff. 2. There are specialised solutions (Maven repositories like Nexus/Artifactory) for the task at hand which can be directly used by Maven without giving URLs to separate artifacts (the URL of the repository suffices to find _all_ artifacts in it). – J Fabian Meier Mar 30 '20 at 08:33
  • Additionally, Nexus/Artifactory usually _does_ contain the source, also in a standardised matter. – J Fabian Meier Mar 30 '20 at 08:36
  • Ok I see your points now. The first one is solid. About the second one, I agree that it is comfortable to be relieved by specifying the URL, but having the option to specify a git repository URL would be a very flexible option. But that collide with the point one. I am thinking about that because I am about to distribute a library in several languages, and having a unique way of distributing it would be so much cheaper. By the way, I want to remove the downvote but you need to edit your answer, otherwise SO does not allow me to do that. – Luca Fagioli Mar 30 '20 at 09:13
  • Thanks. I have added information to the answer itself. – J Fabian Meier Mar 30 '20 at 09:36
  • Thanks to you for the nice discussion. – Luca Fagioli Mar 30 '20 at 09:45