π Version 2.1.3 - Command-line application to assist in building Java and Spring Boot applications, offering automatic and functional scaffold generation for models, controllers, services, repositories, and complete projects.
Add to your pom.xml:
<dependency>
<groupId>io.github.guiaf04</groupId>
<artifactId>spring-scaffold-cli</artifactId>
<version>2.1.3</version>
</dependency>git clone https://github.com/guiaf04/spring-scaffold.git
cd spring-scaffold
mvn clean package -DskipTestsDownload from GitHub Releases
- Complete DevOps Pipeline: Automated CI/CD with GitHub Actions
- Maven Central Integration: Automated deployment with GPG signing
- Quality Assurance: SonarCloud integration and security scanning
- Release Automation: Streamlined release process with automated testing
- Improved Documentation: Clear setup instructions for all integrations
- Better Configuration: Enhanced workflow clarity and API key guidance
- Short aliases:
--pkg,--deps,--entity,--db,-p,-m,-t - Positional parameters:
spring-scaffold model User name:String email:String age:Integer - 50% faster development: Less typing, more productivity
- 100% compatible: All old syntax continues to work
- Models/Entities: Class creation with JPA annotations, validations, Lombok and constructors
- Controllers: Complete REST controllers with CRUD endpoints, Swagger and validations
- Services: Service classes with interfaces, implementations and transactions
- Repositories: JPA/MongoDB repository interfaces with custom queries
- Projects: Complete Spring Boot projects with Maven structure
- Spring Boot Project: Complete structure with pom.xml, application.properties
- Database Configurations: Support for H2, MySQL, PostgreSQL
- Docker: Optional Dockerfile files
- Documentation: Automatic README.md and .gitignore
- Java 17+
- Maven 3.8+
# Generate a model with natural syntax
./spring-scaffold model User name:String email:String age:Integer --pkg com.example.entity
# Generate a controller with aliases
./spring-scaffold controller UserController --entity User --pkg com.example.controller
# Generate a service with shortcuts
./spring-scaffold service UserService -m User -p com.example.service
# Generate a concise repository
./spring-scaffold repository UserRepository -m User -p com.example.repository -t JPA
# Create new project with aliases
./spring-scaffold project my-spring-app --pkg com.example.myapp --deps web,jpa,security# Generate a model
./spring-scaffold model User -p com.example.model -f "name:String,email:String,age:Integer"
# Generate a controller
./spring-scaffold controller UserController -m User
# Generate a service
./spring-scaffold service UserService -m User
# Generate a repository
./spring-scaffold repository UserRepository -m User
# Create new project
./spring-scaffold project my-spring-app --package com.example.myappGenerates a model/entity class with JPA annotations.
π« New Syntax (v2.1.0):
spring-scaffold model <ClassName> [field:type] [field:type] [options]Examples:
# Natural syntax with positional parameters
spring-scaffold model User name:String email:String age:Integer
# With aliases and validation
spring-scaffold model Product name:String price:BigDecimal --pkg com.example.entity --valid
# Using shortcuts
spring-scaffold model Customer name:String email:String -p com.app.model --entity --dataOptions:
-p, --pkg, --package <package>: Class package (default: com.example.model)-f, --fields <fields>: Field list in "name:type,name:type" format (alternative to positional)-t, --tbl, --table <table>: Table name (default: class name in snake_case)--jpa, --entity: Add JPA annotations (default: true)--data, --lombok: Use Lombok annotations (default: true)--valid, --validation: Include Bean Validation annotations (default: false)
Generates a REST controller with CRUD endpoints.
π« New Syntax (v2.1.0):
spring-scaffold controller <ControllerName> [options]Examples:
# With intuitive aliases
spring-scaffold controller UserController --entity User --pkg com.example.controller
# Using shortcuts
spring-scaffold controller ProductController -m Product -p com.app.controllerOptions:
-p, --pkg, --package <package>: Controller package (default: com.example.controller)-m, --model, --entity <model>: Associated model class--path <path>: API base path (default: /api/v1)
Generates a service class.
π« New Syntax (v2.1.0):
spring-scaffold service <ServiceName> [options]Examples:
# With aliases
spring-scaffold service UserService --entity User --pkg com.example.service
# Maximum conciseness
spring-scaffold service ProductService -m Product -p com.app.serviceOptions:
-p, --pkg, --package <package>: Service package (default: com.example.service)-m, --model, --entity <model>: Associated model class--interface: Generate service interface (default: true)
Generates a JPA repository.
π« New Syntax (v2.1.0):
spring-scaffold repository <RepositoryName> [options]Examples:
# With aliases
spring-scaffold repository UserRepository --entity User --pkg com.example.repository
# Using single-letter shortcuts
spring-scaffold repository ProductRepository -m Product -p com.app.repo -t JPAOptions:
-p, --pkg, --package <package>: Repository package (default: com.example.repository)-m, --model, --entity <model>: Associated model class-t, --type <type>: Repository type (JPA, MongoDB) (default: JPA)
Creates a new Spring Boot project.
π« New Syntax (v2.1.0):
spring-scaffold project <project-name> [options]Examples:
# With intuitive aliases
spring-scaffold project my-api --pkg com.example.myapi --deps web,jpa,security --db MYSQL
# Using shortcuts
spring-scaffold project ecommerce -p com.shop.ecommerce -d web,jpa,validation -s 3.2.0Options:
-p, --pkg, --package <package>: Project base package (default: com.example)-g, --group, --group-id <group>: Maven Group ID (default: --package value)-s, --spring, --spring-version <version>: Spring Boot version (default: 3.2.0)-j, --java, --java-version <version>: Java version (default: 17)-d, --deps, --dependencies <deps>: Comma-separated dependencies--db, --database <db>: Database type (H2, MYSQL, POSTGRESQL, MONGODB)
| Command | β Before (v2.0) | β Now (v2.1) | πΎ Savings |
|---|---|---|---|
| Model | --package --fields name:String,email:String |
name:String email:String --pkg |
35% |
| Project | --package --dependencies |
--pkg --deps |
50% |
| Controller | --package --model |
--pkg --entity or -p -m |
40% |
| Repository | --package --model --type |
-p -m -t |
65% |
# 1. Create the model with natural syntax
spring-scaffold model Product name:String price:BigDecimal description:String active:Boolean --pkg com.example.entity --valid
# 2. Create the repository with shortcuts
spring-scaffold repository ProductRepository -m Product -p com.example.repository
# 3. Create the concise service
spring-scaffold service ProductService -m Product -p com.example.service
# 4. Create the controller with aliases
spring-scaffold controller ProductController --entity Product --pkg com.example.controller# Complete project with aliases
spring-scaffold project ecommerce-api --pkg com.example.ecommerce --deps web,jpa,security,validation --db POSTGRESQL
# Multiple entities quickly
cd ecommerce-api
spring-scaffold model User name:String email:String role:String
spring-scaffold model Order total:BigDecimal status:String userId:Long
spring-scaffold model Item name:String price:BigDecimal stock:Integer
# Generate all layers with maximum efficiency
spring-scaffold controller UserController -m User -p com.example.ecommerce.controller
spring-scaffold controller OrderController -m Order -p com.example.ecommerce.controller
spring-scaffold controller ItemController -m Item -p com.example.ecommerce.controllerspring-scaffold model Customer --package com.example.entity --fields name:String,email:String,phone:String,age:Integer
spring-scaffold controller CustomerController --package com.example.controller --model Customer
spring-scaffold service CustomerService --package com.example.service --model Customer
spring-scaffold repository CustomerRepository --package com.example.repository --model Customer --type JPAspring-scaffold model Customer name:String email:String phone:String age:Integer --pkg com.example.entity
spring-scaffold controller CustomerController --entity Customer --pkg com.example.controller
spring-scaffold service CustomerService -m Customer -p com.example.service
spring-scaffold repository CustomerRepository -m Customer -p com.example.repository -t JPAπ― Result: 50% less typing, more natural syntax!
# Template for complete CRUD
ENTITY="Product"
PKG="com.example.ecommerce"
spring-scaffold model $ENTITY name:String price:BigDecimal --pkg $PKG.entity --valid
spring-scaffold repository ${ENTITY}Repository -m $ENTITY -p $PKG.repository
spring-scaffold service ${ENTITY}Service -m $ENTITY -p $PKG.service
spring-scaffold controller ${ENTITY}Controller -m $ENTITY -p $PKG.controllerspring-scaffold-cli/
βββ src/main/java/
β βββ com/scaffold/
β β βββ SpringScaffoldCLI.java # Main class
β β βββ commands/ # CLI commands
β β β βββ ModelCommand.java
β β β βββ ControllerCommand.java
β β β βββ ServiceCommand.java
β β β βββ RepositoryCommand.java
β β β βββ ProjectCommand.java
β β βββ generators/ # Code generators
β β β βββ ModelGenerator.java
β β β βββ ControllerGenerator.java
β β β βββ ServiceGenerator.java
β β β βββ RepositoryGenerator.java
β β β βββ ProjectGenerator.java
β β βββ templates/ # Template engine
β β β βββ TemplateEngine.java
β β β βββ TemplateContext.java
β β βββ models/ # Data models
β β β βββ FieldInfo.java
β β β βββ ClassInfo.java
β β β βββ ProjectInfo.java
β β βββ utils/ # Utilities
β β βββ FileUtils.java
β β βββ NamingUtils.java
β β βββ ValidationUtils.java
βββ src/main/resources/
β βββ templates/ # Mustache templates
β βββ model.java.mustache
β βββ controller.java.mustache
β βββ service.java.mustache
β βββ service-impl.java.mustache
β βββ repository.java.mustache
β βββ project/ # Project templates
β βββ pom.xml.mustache
β βββ application.yml.mustache
β βββ main-class.java.mustache
βββ pom.xml
- Picocli: CLI framework
- Mustache: Template engine
- Lombok: Boilerplate reduction
- Jackson: JSON/YAML manipulation
- Maven: Dependency management
- Fork the repository
- Create a branch for your feature (
git checkout -b feature/new-feature) - Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature/new-feature) - Open a Pull Request
- Create command class in
src/main/java/com/scaffold/commands/ - Implement generator in
src/main/java/com/scaffold/generators/ - Create template in
src/main/resources/templates/ - Register command in main class
mvn test./test-templates.shThis script performs comprehensive testing of all templates:
- β Generates complete Spring Boot project
- β Tests all component generation (model, service, repository, controller)
- β Validates Maven compilation and tests
- β Verifies code quality and internationalization
- β Ensures all templates work correctly together
The script automatically cleans up test artifacts and provides detailed feedback on each test phase.
mvn clean package- English: README.md (this file)
- Portuguese: docs/pt-BR/README-pt.md
This project is licensed under the MIT License - see the LICENSE file for details.
For support, open an issue on GitHub or contact through [email].
- π§ CI/CD Pipeline: Enhanced GPG key handling and Maven deployment configuration
- π οΈ Release Workflow: Improved GPG agent configuration and Maven settings management
- π¦ Deployment: Fixed GPG signing issues in Maven Central deployment process
- π Documentation: Updated SonarQube and OWASP Dependency Check workflow steps
- π Configuration: Added clear instructions for enabling API key requirements
- π§ CI/CD: Improved workflow clarity and configuration guidance
- π CI/CD Pipeline: Complete GitHub Actions workflow implementation
- π Project Templates: Added GitHub templates and configuration
- π§ Build System: Enhanced Maven configuration for Central publishing
- β¨ NEW SYNTAX: Intuitive aliases and positional parameters
- π― Positional parameters:
model User name:String email:String age:Integer - β‘ Short aliases:
--pkg,--deps,--entity,--db,-p,-m,-t - π Productivity: Up to 50% faster development
- π Compatibility: 100% compatible with v2.0.0 syntax
- π Documentation: Updated README with comparative examples
- π Internationalization: Main docs in English, Portuguese in docs/pt-BR/
- β FUNCTIONAL: All commands now generate real files
- π― Complete REST controllers with CRUD, Swagger, validations
- π§ Services with interface + implementation or single class
- π¦ JPA repositories with custom queries
- ποΈ Complete Spring Boot projects with Maven
- π Bug fixes and stability improvements
- π Initial version with CLI structure
- π Functional model command
β οΈ Other commands only simulated generation
See CHANGELOG.md for complete details.
- Kotlin support
- Microservices templates
- Spring Cloud integration
- Automatic documentation generation
- IDE plugins
- GraphQL support
- Performance testing templates