Jar Dependencies on GitHub

I am creating a new Java project on GitHub and I will have several Apache Commons as dependencies.

What are the best methods for establishing that my project needs these jar files? Should I upload dependencies to my GitHub repository (ugly)? Or use a Maven-like tool for this ?

Or is there a way to link the file in another git repository? Apache provides git repositories for its libraries . They are read-only, but I'm ok with this, since I just want to use cans. The bad news is that they contain all the sources, and I just care about the assembled bank. It seems we can not git submodule just a file.

+7
java git github jar dependencies
source share
1 answer

Two approaches:

  • declarative and component , where you declare (describe) which components (jars, exe, other binaries) you need for your project (compile, execute, deploy, etc.) and you use a third-party tool (for example, Maven / Nexus ) to bring these components on demand. This way they are not versioned in your repo. They are declared / described (e.g. in pom.xml if you should use Nexus)
    See Also, “ The Difference Between Git and Nexus? ”.

  • inclusively the system one , where you complete the project with other sources / binaries of the project in order to get everything you need right after the cloning step in your repo (there is no need to access a third-party tool or do something: in any other part of your system).
    With Git, especially if these “other parts” are in the Git repo (for example, apache libs one ), then you will declare these subrepositions as submodules of your main repo.
    Thus, all that you keep in your main repo is a special entry (gitlink, mode 160000) referring to a specific SHA1 of another repo (but you can do this also subordinate to the branch , which is a bit like external svn).
    And rare checks in submodules (as in this example ), you can even update these modules to check only that part of the repo that you want (for example, only banks, not sources).

Please note that you should not store any delivery that you will produce (for example, your own banks) in your GitHub repository.

You can link these shipments with github releases , though.

+5
source share

All Articles