Template Features
Everything you need for modern Java 25 development with best practices built-in
Jump to: ๐ฏ Getting Started โข ๐งช Write & Test โข ๐ง Development โข ๐ Build & Deploy
๐ฏ Getting Started Features
Core platform features that make this template Java 25-ready with modern configuration and build tooling.
Java 25 Ready
This template is built specifically for Java 25, taking advantage of the latest language features and improvements.
Compiler Configuration
<maven.compiler.release>25</maven.compiler.release>
Uses the latest Java 25 compiler release setting for optimal compatibility and feature access.
CI/CD Integration
- name: "Setup JDK"
uses: actions/setup-java@v5
with:
distribution: "oracle"
java-version: 25
GitHub Actions workflow configured with Oracle JDK 25 for consistent builds and deployments.
Java Preview Features Enabled
Experience cutting-edge Java features before they become standard. Preview features are enabled across compilation and test execution for early adoption and experimentation.
Compiler Configuration
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<compilerArgs>
<arg>--enable-preview</arg>
</compilerArgs>
</configuration>
</plugin>
Enables preview features during compilation for access to experimental Java language enhancements.
Test Execution Support
<!-- Surefire (unit tests) -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>--enable-preview</argLine>
</configuration>
</plugin>
<!-- Failsafe (integration tests) -->
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>--enable-preview</argLine>
</configuration>
</plugin>
Both unit and integration tests can leverage preview features with consistent configuration across all test runners.
โน๏ธ What are Preview Features?
Preview features are fully implemented Java language or JVM features that are not yet permanent. They allow developers to provide feedback before features become standard in future releases. Preview features are production-quality but may undergo changes based on community feedback.
Examples: Pattern matching enhancements, structured concurrency, virtual threads improvements, and other experimental APIs.
๐งช Write & Test Code
Comprehensive testing and code quality tools to ensure your code is reliable, maintainable, and follows best practices.
Testing Excellence
Comprehensive testing setup with separation of concerns and modern testing libraries.
Separated Test Execution
Surefire Plugin for unit tests (*Test.java) and Failsafe Plugin for integration tests (*IT.java) with different execution phases.
Parallel Test Execution
JUnit Platform configured for parallel test execution with dynamic strategy for faster feedback loops.
Property-Based Testing
jqwik 1.9.3 for property-based testing to discover edge cases automatically with generated test data.
Architecture Testing
ArchUnit 1.4.1 for testing architectural rules and ensuring code structure compliance.
Fluent Assertions
AssertJ 3.27.6 for readable and maintainable test assertions with fluent API.
Test Data Generation
Instancio 5.5.1 for generating test data objects automatically with customizable constraints.
Parallel Test Configuration
junit.jupiter.execution.parallel.enabled = true
junit.jupiter.execution.parallel.config.strategy = dynamic
junit.jupiter.execution.parallel.mode.default = concurrent
junit.jupiter.execution.parallel.mode.classes.default = concurrent
Code Quality & Formatting
Automated code quality enforcement with industry-standard formatting and best practices.
Spotless Code Formatting
Google Java Format with AOSP style automatically applied during compilation phase.
./mvnw spotless:apply # Format code
./mvnw spotless:check # Verify formatting
Automated Quality Gates
Spotless formatting checks run automatically during the compile phase to ensure consistent code style.
<execution>
<goals><goal>check</goal></goals>
<phase>compile</phase>
</execution>
Maven Configuration & Best Practices
Optimized Maven configuration with wrapper for consistent builds across environments.
Maven Wrapper
No need to install Maven locally. The wrapper ensures consistent Maven version across all environments.
JVM Configuration
Optimized JVM settings in .mvn/jvm.config for better performance and headless operation.
Maven Optimizations
Batch mode, fail-at-end, and no transfer progress for cleaner CI/CD output.
Maven Extensions
OpenTelemetry tracing and build cache extensions for enhanced observability and performance.
Configuration Files
.mvn/jvm.config
-Xmx2048m -Xms512m -Djava.awt.headless=true
Optimized heap settings and headless mode for CI environments.
.mvn/maven.config
-B
--fail-at-end
--no-transfer-progress
Batch mode and optimization flags for better CI/CD experience.
๐ง Development Workflow
Tools and configurations that enhance your daily development experience and productivity.
Development Tools
Modern development tools and integrations for enhanced productivity.
JShell Integration
REPL development support with JShell Maven plugin for interactive Java development and experimentation.
./mvnw jshell:run
Modularization Ready
Java Platform Module System (JPMS) configured with module-info.java files for both main and test sources.
jenv Configuration
Java version management with jenv for easy switching between different Java versions in development.
Fat JAR Support
Maven Shade plugin available via profile for creating executable JAR files with all dependencies.
./mvnw package -Pshade
Java Version Management with jenv
Manage multiple Java versions easily for this project with jenv configuration.
๐ง Setup jenv
# Install jenv (macOS with Homebrew)
brew install jenv
# Add to shell profile
echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(jenv init -)"' >> ~/.zshrc
# Restart shell
source ~/.zshrc
โ Configure Java 25
# Add Java 25 to jenv
jenv add /path/to/java25
# Set Java 25 for this project
jenv local 25
# Verify version
java -version
๐ก Pro Tip
jenv will create a .java-version file in your project directory, ensuring everyone on your team uses the same Java version. The CI/CD pipeline is already configured with Oracle JDK 25.
Quick Reference
Most commonly used commands for quick access.
๐งช Essential Testing
# Run all tests
./mvnw verify
# Run unit tests only
./mvnw test
โจ Code Formatting
# Format code
./mvnw spotless:apply
# Check formatting
./mvnw spotless:check
๐ง Development
# Start JShell REPL
./mvnw jshell:run
# Create fat JAR
./mvnw package -Pshade
๐๏ธ Build
# Clean and build
./mvnw clean compile
# Package without tests
./mvnw package -DskipTests
For a complete command reference, see the Development Guide
๐ Build & Deploy
Performance optimization, build observability, and automated CI/CD pipelines for reliable deployments.
Build Performance & Observability
Enhanced build pipeline with distributed tracing and intelligent caching for faster builds and better insights into build performance.
OpenTelemetry Maven Extension
Version 1.50.0-alpha - Distributed tracing for Maven builds with deep observability into build performance, plugin execution, and bottleneck identification.
Maven Build Cache Extension
Version 1.2.0 - Intelligent build caching that reuses previous build results to dramatically reduce build times for unchanged modules.
Extensions Configuration
Extensions are configured in .mvn/extensions.xml and automatically activated for all Maven builds.
<extensions>
<extension>
<groupId>org.apache.maven.extensions</groupId>
<artifactId>maven-build-cache-extension</artifactId>
<version>1.2.0</version>
</extension>
<extension>
<groupId>io.opentelemetry.contrib</groupId>
<artifactId>opentelemetry-maven-extension</artifactId>
<version>1.50.0-alpha</version>
</extension>
</extensions>
๐ Build Observability Benefits
- Trace Execution: Monitor build phases and plugin execution in real-time
- Performance Insights: Identify slow plugins and optimization opportunities
- Export Options: Send traces to Jaeger, Zipkin, or OTLP-compatible collectors
- CI/CD Monitoring: Track build health and performance trends over time
- Debugging: Detailed spans for troubleshooting build failures
โก Build Cache Benefits
- Incremental Builds: Only rebuild modules that have changed
- Time Savings: Reduce build times by 40-70% in typical scenarios
- Local Cache: Reuse outputs from previous local builds
- Remote Cache: Share build cache across team members (configurable)
- Smart Detection: Automatic cache invalidation when dependencies change
- CI/CD Optimization: Dramatically faster pipeline execution
๐ก Getting Started with Extensions
Build Cache: Works automatically out of the box. Clean builds create cache entries, subsequent builds reuse them. Use ./mvnw clean verify to populate the cache.
OpenTelemetry: Requires environment configuration to export traces. Set OTEL_EXPORTER_OTLP_ENDPOINT to your collector URL, or traces will be logged locally. Perfect for local development insights even without a collector.
CI/CD & Automation
GitHub Actions workflow ready for continuous integration and deployment.
GitHub Actions Workflow
name: Maven Build
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: "Setup JDK"
uses: actions/setup-java@v5
with:
distribution: "oracle"
java-version: 25
cache: "maven"
- name: "Build with Maven"
run: ./mvnw verify
Complete CI/CD pipeline with Oracle JDK 25, Maven caching, and full verification including tests and quality checks.
Ready to Get Started?
Set up your Java 25 project in minutes and start using all these features.