1

I'm not an experienced programmer and I'm mostly self taught. I never really learned how to manage dependencies and I'm having some trouble finding the information I need, which I think it's pretty basic actually.

I have a GitHub project that has dependencies on my own libraries and also third-party libraries. The way I did it was:

  1. Downloaded the needed library files from other GitHub projects
  2. Placed the files in myAppFolder/libraries
  3. Imported them in my code

Is this the right approach?

Also, now I have the following problem: how do I keep these dependencies up to date? Do I have to manually update every file every time there's a new version of the library? Is there a way to automate this?

I tried using git submodules, but they download every file from the repository (including README.md, docs, tests, examples etc), while I only need the actual library files.

1 Answers1

0

Is this the right approach?

In general... no.

A source control system like Git is made to track changes in source code, not binaries (like libraries).

A library is a binary artifact, which needs to be published ("deploy"/"push") to a repository artifact manager like Nexus or Artifactory.

That enables a declarative approach, where you include in your project only a small text file stating what you need (exact version) and where you need it from.

For instance:

Your repository only include text files, and your build tool will fetch for your your dependencies.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250