Dependencies are pre-written code components (libraries/packages) that your application uses instead of building everything from scratch.
🔹 Key Functions
- Adding required libraries
- Managing versions of dependencies
- Updating and removing dependencies
- Resolving conflicts between different versions
🔹 Types of Dependencies
- Direct Dependencies – explicitly added to the project
- Transitive Dependencies – dependencies of dependencies
🔹 Tools for Dependency Management
- Apache Maven (Java)
- Gradle
- npm (Node Package Manager)
- pip (Python Package Manager)
🔹 Importance
- Ensures project consistency
- Reduces development time
- Avoids version conflicts
- Improves maintainability
🔹 Example
A Java project uses a logging library. Instead of writing logging code, it adds the dependency using Maven, which automatically downloads and manages it.
🔹 Build Tools
📌 Definition
Build tools are software tools that automate the process of compiling code, running tests, and packaging applications.
🔹 Functions of Build Tools
- Compile source code
- Run automated tests
- Package the application
- Manage dependencies
- Generate build reports
🔹 Popular Build Tools
- Apache Maven
- Gradle
- Apache Ant
- Make (for C/C++)
🔹 Build Lifecycle (Example)
- Validate
- Compile
- Test
- Package
- Install
- Deploy
🔹 Importance of Build Tools
- Automates repetitive tasks
- Reduces human errors
- Speeds up development
- Ensures consistent builds
- Supports CI/CD pipelines
🔹 Example
Using Maven, a developer can run a single command to:
- Compile code
- Run tests
- Package into a JAR file
🔹 Difference Between Dependency Management & Build Tools
| Aspect | Dependency Management | Build Tools |
|---|---|---|
| Purpose | Manage libraries | Automate build process |
| Focus | External components | Entire build lifecycle |
| Example | npm, pip | Maven, Gradle |
| Role | Supports build | Executes build |