Go further
Gradle & IDE tooling
Generate components with a familiar command, and keep Java-backed templates comfortable to work in.
Browse documentation
Apply the Gradle plugin
The Jaspring plugin provides build tooling. Keep the starter dependency for the runtime. Add Maven Central to plugin repositories, then apply the matching release.
// settings.gradle
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}
// In the existing build.gradle plugins block:
id 'dev.isira.jaspring' version '0.2.0'
Generate a component
The task creates a Java class and package-relative HTML and CSS resources. It refuses to overwrite existing targets. By default, each component gets its own subpackage; --flat omits that final directory.
./gradlew generateComponent --name=user-card --package=com.example.components
# Generated files:
# src/main/java/com/example/components/usercard/UserCardComponent.java
# src/main/resources/com/example/components/usercard/user-card.component.html
# src/main/resources/com/example/components/usercard/user-card.component.css
Shape the output
Options include --prefix, --selector, --inline-template, --inline-style, --display-block, --style=none, and --change-detection=OnPush. Parent paths in a name become Java subpackages. Use a qualified task such as :app:generateComponent in a multi-module application.
The task creates component files only. It does not generate routes, controllers, tests, TypeScript, Sass, or NgModules. List the available options with ./gradlew help --task generateComponent.
./gradlew generateComponent --name=counter --package=com.example.components --flat --inline-template --inline-style --change-detection=OnPush
IntelliJ IDEA support
The framework repository includes a standalone IntelliJ plugin under tools/intellij-plugin. It supplies Java-backed template completion, navigation, and refactoring support. Follow that directory’s README for its build and installation instructions.