Course contentsShow
← Software Engineering
Lesson 667 of 1,93321. Build Automation and Dependency ManagementFree lesson

Declaring Dependencies Explicitly

Why dependencies must be declared in manifest files rather than assumed or manually managed in the codebase.

Declaring Dependencies Explicitly

You'll learn why modern build systems require explicit dependency declarations in manifest files rather than assuming what libraries your code needs.

The Problem with Implicit Dependencies

Imagine borrowing ingredients from your neighbor every time you bake, but never writing down what you actually need. When you move houses or bake somewhere new, you can't remember what was borrowed versus what you already had. Your recipe becomes impossible to reproduce.

This is exactly what happens when dependencies aren't explicitly declared. When your code imports requests or lodash or junit, but those packages aren't listed anywhere formal, several problems emerge:

  • New developers can't set up the project — they don't know what to install
  • Build servers fail mysteriously because libraries are missing
  • Different environments may have different versions installed, causing subtle bugs
  • Reproducibility becomes impossible — builds work on one machine but not another

The Manifest File Solution

Build tools use manifest files (like package.json, requirements.txt, pom.xml, or Cargo.toml) to explicitly list every external library your project needs. These files serve as a contract: "This is exactly what this project requires to build and run."

When you declare dependencies explicitly:

  • Anyone can clone your code and run one command to get everything needed
  • CI/CD systems can reliably reproduce builds
  • Version conflicts become visible and manageable
  • Your project is self-documenting about its external requirements

Instead of assuming a library exists because it's on your machine, you declare it. The build tool then ensures it's present before compilation or execution begins.

Key Takeaway: Dependencies must be declared in manifest files to make builds reproducible, environments consistent, and projects accessible to all team members and build systems — never rely on what happens to be installed locally.