Skip to main content

haft add

Add dependencies to an existing Spring Boot project.

Usage

haft add                              # Interactive search picker
haft add --browse # Browse by category
haft add <dependency> [dependencies...]
haft add <groupId:artifactId>
haft add <groupId:artifactId:version>

Description

The add command modifies your build file (pom.xml or build.gradle) to add new dependencies. It supports:

  • Interactive mode — Search and select from 230+ shortcuts
  • Browse mode — Navigate dependencies by category
  • Shortcuts — Common dependencies like lombok, jpa, web, jwt
  • Maven coordinates — Any dependency as groupId:artifactId
  • Maven Central verification — Auto-verify and fetch latest versions

Interactive Modes

Search Picker (Default)

haft add

Opens an interactive TUI where you can:

  • Type to search/filter dependencies
  • Select multiple with Space
  • Navigate with /, PgUp/PgDown
  • Select all visible with a, none with n
  • Confirm with Enter, cancel with Esc

Category Browser

haft add --browse
haft add -b

Opens a category-based browser similar to the init wizard:

  • Jump to categories with 0-9 keys
  • Cycle categories with Tab/Shift+Tab
  • Search within category with /

Examples

Add Using Shortcuts

# Add Lombok
haft add lombok

# Add multiple dependencies
haft add jpa validation lombok

# Add JWT (adds all 3 JJWT artifacts)
haft add jwt

# Add database driver
haft add postgresql

Add Using Maven Coordinates

# Without version (fetches latest from Maven Central)
haft add org.mapstruct:mapstruct

# With specific version
haft add io.jsonwebtoken:jjwt-api:0.12.5

Dependencies are automatically verified against Maven Central. If a dependency doesn't exist, you'll get an error:

ERROR ✗ dependency 'com.fake:nonexistent' not found on Maven Central

Override Scope

# Add as test dependency
haft add h2 --scope test

# Add as provided
haft add org.example:my-processor --scope provided

List Available Shortcuts

haft add --list

Flags

FlagShortDescription
--browse-bBrowse dependencies by category
--listList available dependency shortcuts
--scopeSet dependency scope (compile, runtime, test, provided)
--versionOverride default version
--jsonOutput result as JSON
--no-interactiveSkip interactive prompts

Available Shortcuts (230+)

Web

ShortcutDescription
webSpring Boot Web (Spring MVC)
webfluxSpring WebFlux (reactive)
graphqlSpring GraphQL
websocketWebSocket support
hateoasHypermedia-driven REST APIs
data-restExpose repositories as REST endpoints
feignDeclarative REST client (OpenFeign)
resilience4jFault tolerance (circuit breaker)
restclientSynchronous HTTP client
webclientReactive HTTP client
session-redisDistributed sessions with Redis
session-jdbcDistributed sessions with JDBC
grpcgRPC framework for Spring Boot
bucket4jRate limiting library
spring-cloud-gatewayAPI Gateway for microservices
eurekaService discovery with Eureka
consulService discovery with Consul
config-serverCentralized configuration server
config-clientConfig server client

SQL

ShortcutDescription
jpaSpring Data JPA
jdbcSpring JDBC
postgresqlPostgreSQL driver
mysqlMySQL driver
mariadbMariaDB driver
h2H2 in-memory database
flywayFlyway migrations
liquibaseLiquibase migrations
r2dbcReactive database access
r2dbc-postgresqlReactive PostgreSQL driver
mybatisMyBatis SQL mapping framework
jooqType-safe SQL query builder
oracleOracle database JDBC driver
sqlserverMicrosoft SQL Server JDBC driver
clickhouseClickHouse column-oriented OLAP
cockroachdbCockroachDB distributed SQL
timescaledbTimescaleDB time-series
voltdbVoltDB in-memory SQL
sqliteSQLite embedded database
hsqldbHSQLDB embedded database
derbyApache Derby embedded database
duckdbDuckDB analytical database
questdbQuestDB time-series database

NoSQL

ShortcutDescription
mongodbSpring Data MongoDB
mongodb-reactiveReactive MongoDB support
redisSpring Data Redis
elasticsearchSpring Data Elasticsearch
cassandraSpring Data Cassandra
neo4jSpring Data Neo4j
couchbaseCouchbase NoSQL database
scylladbScyllaDB (Cassandra-compatible)
influxdbInfluxDB time-series database
arangodbArangoDB multi-model database
hazelcastHazelcast in-memory data grid
igniteApache Ignite distributed computing
memcachedMemcached distributed caching
dynamodb-localDynamoDB enhanced client

Security

ShortcutDescription
securitySpring Security
oauth2-clientOAuth2 client
oauth2-resource-serverOAuth2 resource server
oauth2-authorization-serverBuild your own OAuth2 authorization server
jwtJJWT library (api + impl + jackson)
ldapLDAP authentication and operations
passayPassword validation library
keycloakKeycloak admin client
auth0Auth0 authentication
vaultHashiCorp Vault integration
bouncy-castleBouncy Castle cryptography
jasyptEncryption for properties
nimbus-joseNimbus JOSE+JWT
otpTOTP/HOTP for 2FA
supertokensSuperTokens open source auth
kratosOry Kratos identity management
casCAS authentication client
samlSpring Security SAML
spring-sessionDistributed session management
recaptchaGoogle reCAPTCHA integration

Messaging

ShortcutDescription
amqpRabbitMQ (Spring AMQP)
rabbitmqRabbitMQ Java client (direct)
kafkaApache Kafka
pulsarApache Pulsar messaging
activemqActiveMQ JMS messaging
artemisApache ActiveMQ Artemis
rsocketRSocket reactive messaging
natsNATS messaging system
zeromqZeroMQ high-performance messaging

I/O

ShortcutDescription
validationBean Validation
mailJava Mail
cacheSpring Cache
batchSpring Batch
quartzQuartz Scheduler
schedulerTask scheduling with @Scheduled
commons-ioApache Commons IO
jackson-datatypeJackson Java 8 datatypes
apache-poiMicrosoft Office file handling
itextPDF generation and manipulation
minioS3-compatible object storage client
json-pathJSON path query library

Template Engines

ShortcutDescription
thymeleafThymeleaf templates
freemarkerFreeMarker templates
mustacheMustache templates

Ops

ShortcutDescription
actuatorSpring Boot Actuator
micrometerPrometheus metrics exporter

Observability

ShortcutDescription
prometheusPrometheus metrics registry
zipkinDistributed tracing with Zipkin
opentelemetryOpenTelemetry distributed tracing
jaegerDistributed tracing with Jaeger
datadogDatadog APM metrics
newrelicNew Relic APM metrics
sentrySentry error tracking
lokiGrafana Loki logging
grafanaGrafana LGTM metrics

AI

ShortcutDescription
openaiOpenAI (ChatGPT, GPT-4) integration
anthropicAnthropic Claude integration
ollamaOllama local LLM integration
azure-openaiAzure OpenAI integration
bedrockAmazon Bedrock AI integration
vertex-aiGoogle Vertex AI Gemini integration
mistralMistral AI integration
pgvectorPostgreSQL vector database for AI
langchain4jLangChain for Java (LLM orchestration)
pineconePinecone vector database client
weaviateWeaviate vector database client
qdrantQdrant vector database client
chromaChroma vector database client
djlDeep Java Library (Amazon ML toolkit)
wekaWeka Machine Learning algorithms
corenlpStanford CoreNLP (NLP processing)

Cloud

ShortcutDescription
aws-s3Amazon S3 file storage
aws-sqsAmazon Simple Queue Service
aws-sesAmazon Simple Email Service
aws-snsAmazon Simple Notification Service
aws-dynamodbAmazon DynamoDB NoSQL database
aws-lambdaAmazon Lambda serverless
aws-cognitoAmazon Cognito authentication
aws-secretsmanagerAmazon Secrets Manager
aws-cloudwatchAmazon CloudWatch monitoring
aws-kinesisAmazon Kinesis streaming
gcp-storageGoogle Cloud Storage
gcp-pubsubGoogle Cloud Pub/Sub
gcp-bigqueryGoogle BigQuery
gcp-firestoreGoogle Firestore
gcp-secretmanagerGoogle Secret Manager
gcp-functionsGoogle Cloud Functions
azure-storageAzure Blob Storage
azure-servicebusAzure Service Bus
azure-keyvaultAzure Key Vault
azure-cosmosdbAzure Cosmos DB
azure-functionsAzure Functions

Notifications

ShortcutDescription
twilioSMS, WhatsApp, Voice API
sendgridSendGrid email delivery
mailersendMailerSend transactional email
mailgunMailgun email delivery
firebase-adminFirebase push notifications
pusherPusher real-time messaging
slackSlack API integration
discordDiscord bot integration
telegramTelegram bot API
onesignalOneSignal push notifications

Payments

ShortcutDescription
stripeStripe payment processing
paypalPayPal payment SDK
braintreeBraintree payment processing
squareSquare payment processing
razorpayRazorpay payment gateway
mollieMollie payment gateway
adyenAdyen payment platform
ShortcutDescription
algoliaAlgolia search-as-a-service
meilisearchMeilisearch open-source search
typesenseTypesense typo-tolerant search
solrApache Solr enterprise search
opensearchOpenSearch (Elasticsearch fork)

Utilities

ShortcutDescription
okhttpOkHttp HTTP client
retrofitRetrofit type-safe REST client
httpclient5Apache HttpClient 5
jsoupHTML parsing and web scraping
zxingQR code and barcode generation
thumbnailatorImage resizing and processing
jasperreportsReport generation
jfreechartChart generation
opencsvCSV parsing and writing
snakeyamlYAML parsing
commonmarkMarkdown parsing
flexmarkAdvanced Markdown processor
protobufGoogle Protocol Buffers
avroApache Avro serialization
msgpackMessagePack binary format
kryoFast binary serialization
jaxbXML binding (Java 11+)
dom4jXML parsing
xstreamXML serialization
jschSSH and SFTP client
sshjModern SSH client
libphonenumberPhone number validation
slugURL slug generation
emojiEmoji parsing
joda-timeDate/time library (legacy)
jnaJava Native Access

Workflow

ShortcutDescription
camundaCamunda workflow automation
flowableFlowable BPMN engine
temporalTemporal workflow orchestration

Developer Tools

ShortcutDescription
lombokLombok annotations
devtoolsSpring Boot DevTools
mapstructMapStruct bean mapping
openapiSpringDoc OpenAPI (Swagger UI)
commons-langApache Commons Lang
guavaGoogle Guava
modelmapperModelMapper
config-processorIDE support for @ConfigurationProperties
docker-composeDocker Compose development support
nativeGraalVM native image support
vavrFunctional programming library
immutablesImmutable object generation
record-builderBuilder pattern for Java records
jmoleculesDDD architectural concepts
spotbugsSpotBugs static analysis
error-proneError Prone static analysis
checker-qualChecker Framework annotations

Testing

ShortcutDescription
testSpring Boot Test
testcontainersTestcontainers
security-testSpring Security Test
mockitoMockito mocking
restdocsSpring REST Docs
wiremockWireMock HTTP mock server
rest-assuredREST Assured API testing
assertjAssertJ fluent assertions
awaitilityAwaitility async testing
archunitArchUnit architecture testing
jsonassertJSONAssert comparison
gatlingGatling load testing
jmhJMH microbenchmark harness
fakerDataFaker test data generation
greenmailGreenMail email testing
seleniumSelenium browser automation
selenideSelenide concise UI tests
playwrightMicrosoft Playwright browser automation
cucumberCucumber BDD testing
hoverflyHoverfly API simulation
pactPact consumer-driven contract testing

Maps

ShortcutDescription
google-mapsGoogle Maps Server SDK
mapboxMapbox Java SDK
graphhopperGraphHopper routing engine
h3Uber H3 Hexagonal Spatial Index
jtsJTS Topology Suite (geometry)
geotoolsGeoTools geospatial data tools
ip2locationIP2Location geo lookup
maxmindMaxMind GeoIP2 database

Media

ShortcutDescription
ffmpegFFmpeg video/audio processing
opencvOpenCV computer vision
pdfboxApache PDFBox PDF handling
tikaApache Tika content detection
docx4jDocx4j Word/PowerPoint files
openhtmltopdfOpenHTMLtoPDF converter
batikApache Batik SVG tools
metadata-extractorImage metadata extraction
imgscalrImgScalr image scaling
jxlsJXLS Excel templates
flying-saucerFlying Saucer XHTML to PDF
barcode4jBarcode4J barcode generation

Fintech

ShortcutDescription
web3jWeb3j Ethereum integration
bitcoinjBitcoinJ Bitcoin protocol
plaidPlaid bank account linking
xchangeXChange crypto exchange library
stellarStellar network SDK

Social

ShortcutDescription
facebook-sdkFacebook Graph API
twitter-apiTwitter/X API v2
linkedin-apiLinkedIn API
zoomZoom API integration
agoraAgora real-time video/audio
matrixMatrix.org decentralized chat

Data

ShortcutDescription
sparkApache Spark Java API
flinkApache Flink stream processing
hadoopHadoop client libraries
tablesawTablesaw Java Dataframes
commons-mathApache Commons Math
nd4jND4J N-Dimensional Arrays
joda-moneyJoda-Money currency handling
jgraphtJGraphT graph algorithms

Feature Flags

ShortcutDescription
unleashUnleash feature toggle
launchdarklyLaunchDarkly feature flags
flagsmithFlagsmith feature flags
togglzTogglz feature flags for Spring
ff4jFF4J feature flipping

Microservices

ShortcutDescription
spring-cloud-streamSpring Cloud Stream (Kafka/RabbitMQ)
spring-cloud-busSpring Cloud Bus state broadcast
spring-cloud-functionSpring Cloud Function serverless
spring-retrySpring Retry logic
shedlockShedLock distributed scheduling lock
etcdEtcd distributed key-value
zookeeperApache Zookeeper client
daprDapr distributed runtime SDK
grpc-servergRPC server starter

Integration

ShortcutDescription
spring-integrationSpring Integration EIP
apache-camelApache Camel routing
spring-cloud-data-flowSpring Cloud Data Flow
spring-cloud-taskSpring Cloud Task ephemeral tasks

IoT

ShortcutDescription
mqtt-pahoEclipse Paho MQTT client
spring-integration-mqttSpring Integration MQTT
coapCalifornium CoAP protocol
modbusModbus industrial protocol
pi4jPi4J Raspberry Pi control

DevOps

ShortcutDescription
jibGoogle Jib Docker builds
docker-javaDocker Java API
kubernetes-clientKubernetes Java client
fabric8Fabric8 Kubernetes client

Quality

ShortcutDescription
jacocoJaCoCo code coverage
checkstyleCheckstyle coding standards
spotlessSpotless code formatting
pmdPMD source code analyzer
sonarSonarQube integration

Caching

ShortcutDescription
caffeineCaffeine high-performance cache
ehcacheEhcache enterprise caching
infinispanInfinispan data grid
hazelcast-jetHazelcast Jet stream processing

Content

ShortcutDescription
romeRome RSS/Atom feeds
htmlunitHtmlUnit headless browser
blikiBliki Wikipedia parser
emoji-javaEmoji Java string handling

Networking

ShortcutDescription
nettyNetty async network framework
pcap4jPcap4J packet capture
dns-javadnsjava DNS protocol

API

ShortcutDescription
springdocSpringDoc OpenAPI 3
netflix-dgsNetflix DGS GraphQL
asyncapiAsyncAPI event-driven docs
avro-serializerAvro Kafka serializer
json-schemaJSON Schema validation
graphql-kickstartGraphQL Kickstart starter

Scheduling

ShortcutDescription
jobrunrJobRunr distributed jobs
db-schedulerDB Scheduler persistent tasks

Logging

ShortcutDescription
logbackLogback logging framework
log4j2Apache Log4j 2 logging
slf4jSLF4J logging facade

What Gets Added

Maven Example: haft add lombok

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>

Gradle Example: haft add lombok

// build.gradle (Groovy)
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
// build.gradle.kts (Kotlin)
compileOnly("org.projectlombok:lombok")
annotationProcessor("org.projectlombok:lombok")

Maven Example: haft add jwt

Adds all three JJWT artifacts:

<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.12.5</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.12.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.12.5</version>
<scope>runtime</scope>
</dependency>

Maven Example: haft add org.mapstruct:mapstruct

Auto-fetches latest version from Maven Central:

<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>1.5.5.Final</version>
</dependency>

Gradle Example: haft add org.mapstruct:mapstruct

// build.gradle (Groovy)
implementation 'org.mapstruct:mapstruct:1.5.5.Final'
// build.gradle.kts (Kotlin)
implementation("org.mapstruct:mapstruct:1.5.5.Final")

Build Tool Detection

Haft automatically detects your build tool:

File FoundBuild Tool
pom.xmlMaven
build.gradle.ktsGradle (Kotlin DSL)
build.gradleGradle (Groovy DSL)

Duplicate Detection

Haft automatically detects existing dependencies and skips them:

$ haft add lombok
WARN ⚠ Skipped (already exists) dependency=org.projectlombok:lombok
INFO ℹ No new dependencies added (all already exist)

See Also