This guide will help you set up your new project from this Gradle boilerplate template.
Before you begin, ensure you have:
- ☑️ Java 17 or higher installed (Download OpenJDK)
- ☑️ Git installed
- ☑️ VS Code with Java extensions (recommended)
- Click "Use this template" button on GitHub
- Choose "Create a new repository"
- Fill in your repository details
- Clone your new repository
# Open the project in VS Code
code your-project-name
# Or navigate to the project directory
cd your-project-name-
settings.gradle.kts - Change project name:
rootProject.name = "your-project-name"
-
Package Structure - Rename package from
com.example.gradle:- Update package declarations in all
.javafiles - Move files to new package directory structure
- Update imports accordingly
- Update package declarations in all
-
build.gradle.kts - Update main class reference:
application { mainClass.set("com.yourcompany.yourproject.App") } -
README.md - Replace with your project information
# On Windows
.\gradlew.bat build
# On Unix/macOS
./gradlew buildIf you encounter SSL certificate issues (common in corporate environments), you may need to:
- Configure proxy settings
- Import certificates
- Use
--insecureflag temporarily
Run the included tests:
.\gradlew.bat test # Windows
./gradlew test # Unix/macOSRun the application:
.\gradlew.bat run # Windows
./gradlew run # Unix/macOSThe following extensions will be automatically suggested:
- Extension Pack for Java
- Gradle for Java
Press Ctrl+Shift+P and type "Tasks: Run Task" to see:
- Gradle: Build - Build the project
- Gradle: Test - Run tests
- Gradle: Run - Run the application
- Gradle: Code Quality - Run code quality checks
- Gradle: Test Coverage - Generate coverage reports
your-project/
├── .github/ # GitHub configuration
│ ├── workflows/ci.yml # CI/CD pipeline
│ └── copilot-instructions.md # Copilot setup
├── .vscode/ # VS Code configuration
│ └── tasks.json # Build tasks
├── config/ # Code quality configurations
│ ├── checkstyle/ # Checkstyle rules
│ ├── pmd/ # PMD rules
│ └── spotbugs/ # SpotBugs exclusions
├── gradle/ # Gradle wrapper
├── src/
│ ├── main/java/ # Application source code
│ ├── test/java/ # Test source code
│ └── main/resources/ # Resources (configs, etc.)
├── build.gradle.kts # Gradle build script
├── settings.gradle.kts # Gradle settings
└── README.md # This file
Edit build.gradle.kts:
dependencies {
implementation("group:artifact:version")
testImplementation("test-group:test-artifact:version")
}- Checkstyle: Edit
config/checkstyle/checkstyle.xml - PMD: Edit
config/pmd/ruleset.xml - SpotBugs: Edit
config/spotbugs/exclude.xml
The GitHub Actions workflow (.github/workflows/ci.yml) runs:
- Tests on multiple platforms (Ubuntu, Windows, macOS)
- Code quality checks
- Build verification
- Test coverage reporting
In corporate environments, you might see SSL errors. Solutions:
- Configure proxy in
gradle.properties - Import corporate certificates
- Use
--insecureflag (not recommended for production)
Ensure Java 17+ is installed and set as default:
java -version # Should show version 17 or higherMake Gradle wrapper executable:
chmod +x gradlew- ✅ Build successfully compiles
- ✅ Tests pass
- ✅ Customize package names and project details
- ✅ Add your business logic
- ✅ Write comprehensive tests
- ✅ Configure any additional tools you need
- ✅ Set up your development workflow
- ✅ Deploy using the included CI/CD pipeline
Happy coding! 🎉