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 |
