Getting started
Requirements
The following tools must be installed to use the plugin:
- JDK 21 build: Gradle 8.5+
- JDK 17 build: Gradle 8.5+
The plugin is built and tested on Linux, Mac OS, Windows (see the list of build environments used in the contributing notes).
Supported distributions
Steps
- Install the plugin.
Using Gradle DSL (recommended)
plugins { // For JDK 21+ id 'org.siouan.frontend-jdk21' version '11.0.0' // For JDK 17+ id 'org.siouan.frontend-jdk17' version '11.0.0' }Using Gradle build script block
buildscript { repositories { url 'https://plugins.gradle.org/m2/' } dependencies { // For JDK 21+ classpath 'org.siouan:frontend-gradle-plugin-jdk21:11.0.0' // For JDK 17+ classpath 'org.siouan:frontend-gradle-plugin-jdk17:11.0.0' } } // For JDK 21+ apply plugin: 'org.siouan.frontend-jdk21' // For JDK 17+ apply plugin: 'org.siouan.frontend-jdk17'
- Starting from Node.js 25+, Corepack is not bundled in the distribution anymore. Set the
corepackVersionproperty with a non-nullvalue. - Define the
packageManagerproperty in thepackage.jsonfile:(npm|pnpm|yarn)@x.y.z(+hash)(other syntax defined by Corepack is not supported). - Add
.frontend-gradle-plugin/directory to.gitignorefile(s). - Configure the build, test (check), deploy (publish) phases in your project, with the help of the built-in tasks dependency tree and optionally examples provided for typical use cases.
- Run
gradlew build. - Additionally:
- If you need to execute an instant command with a node-based executable (e.g. to install a dependency), invoke one of the following tasks on a Gradle command line:
runNode,runCorepack,runNpm,runPnpm,runYarn. - If you need to define a reusable node-based command with eventual custom inputs, outputs, or environment, use one of the following task types:
RunNodeTaskType,RunCorepackTaskType,RunNpmTaskType,RunPnpmTaskType,RunYarnTaskType. - If you need to run
node/corepack/npm/pnpm/yarnexecutables from a command line (e.g. to start a development server), take a look at the FAQ.
- If you need to execute an instant command with a node-based executable (e.g. to install a dependency), invoke one of the following tasks on a Gradle command line: