haft remove
Remove dependencies from an existing Spring Boot project.
Usage
haft remove # Interactive picker
haft remove <dependency> [dependencies...]
haft remove <groupId:artifactId>
Aliases
haft rm # Short alias
Description
The remove command modifies your build file (pom.xml or build.gradle) to remove dependencies. It supports:
- Interactive mode — Select dependencies to remove from a list
- By artifact name — Remove by artifact ID (e.g.,
lombok) - By coordinates — Remove by full coordinates (e.g.,
org.projectlombok:lombok) - Suffix matching —
jpamatchesspring-boot-starter-jpa - Multiple removal — Remove several dependencies at once
Interactive Mode
haft remove
# or
haft rm
Opens an interactive TUI showing all current dependencies where you can:
- Type to search/filter
- Select multiple with
Space - Navigate with
↑/↓,PgUp/PgDown - Select all with
a, none withn - Confirm removal with
Enter - Cancel with
Esc
The picker shows:
- Artifact ID (highlighted)
- Group ID
- Version (if specified)
- Scope (if not compile)
Flags
| Flag | Description |
|---|---|
--json | Output result as JSON |
--no-interactive | Skip interactive picker (requires dependency argument) |
Examples
Remove by Artifact Name
# Remove Lombok
haft remove lombok
# Remove Spring Web
haft remove spring-boot-starter-web
Remove by Coordinates
haft remove org.projectlombok:lombok
haft remove io.jsonwebtoken:jjwt-api
Remove Multiple Dependencies
haft remove lombok validation h2
haft rm jjwt-api jjwt-impl jjwt-jackson
Suffix Matching
Haft supports suffix matching for convenience:
# These are equivalent:
haft remove spring-boot-starter-jpa
haft remove jpa
# Matches spring-boot-starter-web
haft remove web
Output
Successful Removal
$ haft remove lombok validation
INFO ✓ Removed dependency=org.projectlombok:lombok
INFO ✓ Removed dependency=org.springframework.boot:spring-boot-starter-validation
INFO ✓ Removed 2 dependencies from pom.xml
Dependency Not Found
$ haft remove nonexistent
WARN ⚠ Dependency not found input=nonexistent
INFO ℹ No dependencies removed (none found)
No Dependencies in Project
$ haft remove
INFO ℹ No dependencies found in pom.xml
Keyboard Shortcuts (Interactive Mode)
| Key | Action |
|---|---|
↑ ↓ | Navigate |
Space | Toggle selection |
a | Select all visible |
n | Select none |
Enter | Confirm removal |
Esc | Cancel |
| Type | Filter dependencies |
Backspace | Clear filter |
How It Works
- Parses your build file (
pom.xmlorbuild.gradle) to find all dependencies - In interactive mode, displays them for selection
- In CLI mode, matches input against:
- Full coordinates (
groupId:artifactId) - Exact artifact ID match
- Suffix match (for Spring starters)
- Full coordinates (
- Removes matched dependencies from the build file
- Writes the updated file
Build Tool Detection
Haft automatically detects your build tool:
| File Found | Build Tool |
|---|---|
pom.xml | Maven |
build.gradle.kts | Gradle (Kotlin DSL) |
build.gradle | Gradle (Groovy DSL) |
Tips
Removing JWT Dependencies
If you added JWT with haft add jwt, it added 3 artifacts. Remove them individually:
haft rm jjwt-api jjwt-impl jjwt-jackson
Or use the interactive picker to select all three.
Removing Spring Starters
For Spring Boot starters, you can use the short name:
haft rm web jpa security
# Removes:
# - spring-boot-starter-web
# - spring-boot-starter-data-jpa
# - spring-boot-starter-security
Double-Check with Git
Since haft remove modifies your build file, use Git to review changes:
haft rm lombok
git diff pom.xml # Maven
git diff build.gradle # Gradle
See Also
- haft add — Add dependencies
- Dependencies Guide — Full dependency reference