### Configure pnpm with frontend-maven-plugin Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt Shows the setup for installing Node.js and pnpm, followed by executing package installation and test phases within the Maven build process. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 target install node and pnpm install-node-and-pnpm v24.12.0 v10.26.1 pnpm install pnpm install pnpm test pnpm test test ``` -------------------------------- ### Running Bun Install with Frontend Maven Plugin Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Configures the frontend-maven-plugin to execute a Bun installation command. The goal is set to 'bun', and the 'install' argument is specified. This is typically performed during the 'generate-resources' phase. ```xml bun install bun generate-resources install ``` -------------------------------- ### Install Node.js/npm and Run Gulp with Frontend Maven Plugin Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt Integrates Node.js and npm installation with the frontend-maven-plugin, followed by Gulp task execution. This setup supports incremental builds by defining source and output directories for Gulp tasks. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 install node and npm install-node-and-npm v24.12.0 npm install npm gulp build gulp generate-resources build src/main/frontend target/frontend ``` -------------------------------- ### Configure Yarn with frontend-maven-plugin Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt Demonstrates how to install Node.js and Yarn, then execute install and build commands. It includes optional configurations for private registries and proxy settings. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 target install node and yarn install-node-and-yarn v24.12.0 v1.22.22 yarn install yarn install https://registry.example.com/ false yarn build yarn build ``` -------------------------------- ### Configuring Installation Directory for Frontend Maven Plugin Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Specifies the directory where Node.js and npm will be installed by the frontend-maven-plugin. This configuration can be applied globally within the plugin's main configuration or per goal. The example shows a global setting. ```xml com.github.eirslett frontend-maven-plugin target ``` -------------------------------- ### Configure Bun Installation Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Configures the plugin to download and install a specific version of the Bun runtime locally to the project. ```xml install bun install-bun generate-resources v1.1.34 ``` -------------------------------- ### Install Node.js and npm with Maven Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt This snippet configures the frontend-maven-plugin to download and install a specific version of Node.js and npm locally for the project. It's typically run during the 'generate-resources' phase. Dependencies include the plugin itself and specified Node/npm versions. Inputs are configuration parameters like nodeVersion and npmVersion. Outputs are local installations of Node.js and npm. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 install node and npm install-node-and-npm generate-resources v24.12.0 11.6.2 https://nodejs.org/dist/ https://registry.npmjs.org/npm/-/ my-node-server ``` -------------------------------- ### Install Bun Runtime Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt Configures the plugin to install the Bun runtime locally within the project directory. This enables fast execution and bundling of JavaScript and TypeScript projects. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 target install bun install-bun v1.3.5 ``` -------------------------------- ### Execute JSPM Installation Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Configuring the plugin to run jspm install, which manages dependencies in the jspm_packages directory. ```xml jspm install jspm install ``` -------------------------------- ### Install and Run Bun with Frontend Maven Plugin Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt Configures the frontend-maven-plugin to install a specific version of Bun and execute Bun commands. This is useful for managing JavaScript/TypeScript packages and running scripts efficiently. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 target install bun install-bun v1.3.5 bun install bun install ``` -------------------------------- ### Configure Custom Installation Directory Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt This snippet configures the plugin to install Node and npm into a specific directory, such as the target folder, which is useful for clean build environments. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 target install node and npm install-node-and-npm v24.12.0 ``` -------------------------------- ### Configure Node.js and npm installation Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Configures the plugin to download and install specific versions of Node.js and npm locally. It supports custom download roots and proxy configurations. ```xml install node and npm install-node-and-npm generate-resources v24.12.0 11.6.2 http://myproxy.example.org/nodejs/ ``` -------------------------------- ### Execute npm and npx Commands Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Demonstrates how to run npm install or execute arbitrary packages using npx within the Maven build lifecycle. ```xml npm install npm generate-resources install say hello npx generate-resources cowsay hello ``` -------------------------------- ### Install Node.js/npm and Run Grunt with Frontend Maven Plugin Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt Sets up Node.js and npm using the frontend-maven-plugin, then executes Grunt tasks. This configuration allows for incremental builds and specifies directories for source and output, along with trigger files for rebuild detection. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 install node and npm install-node-and-npm v24.12.0 npm install npm grunt build grunt generate-resources build src/main/frontend target/frontend Gruntfile.js package.json ``` -------------------------------- ### Install Node.js and Corepack Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt Configures the plugin to download and install a specific version of Node.js and Corepack. Corepack allows for seamless management of package managers like Yarn and pnpm. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 target install node and corepack install-node-and-corepack v24.12.0 0.25.2 ``` -------------------------------- ### Configure Frontend Maven Plugin for Fullstack Builds Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt This XML configuration demonstrates how to install Node.js and npm, run dependency installation, execute linting, perform unit tests, and build the frontend assets within a Maven project. It also includes a resource plugin step to copy the final build artifacts into the Spring Boot static folder. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 src/main/frontend target install-node-and-npm install-node-and-npm v24.12.0 11.6.2 npm-ci npm ci npm-lint npm process-resources run lint npm-test npm test run test -- --ci --coverage true npm-build npm prepare-package run build production ``` -------------------------------- ### Install Node.js and Yarn with Maven Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt This configuration installs Node.js and the Yarn package manager locally. It supports both Yarn Classic and Yarn Berry, automatically detecting Yarn Berry if a .yarnrc.yml file is present. The plugin downloads specified versions of Node.js and Yarn, making them available for project builds. Custom download roots can be specified. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 target install node and yarn install-node-and-yarn v24.12.0 v1.22.22 https://nodejs.org/dist/ https://github.com/yarnpkg/yarn/releases/download/ ``` -------------------------------- ### Configure Node.js and Corepack Installation Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Configures the plugin to download and install a specific version of Node.js and Corepack locally. It supports custom download mirrors for environments with restricted internet access. ```xml install-node-and-corepack install-node-and-corepack generate-resources v24.12.0 v0.25.2 http://myproxy.example.org/nodejs/ http://myproxy.example.org/corepack/ ``` -------------------------------- ### Configure Webpack Build Execution Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt This snippet demonstrates how to configure the frontend-maven-plugin to run a Webpack build during the generate-resources phase. It includes node installation, dependency installation, and specific Webpack arguments. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 install node and npm install-node-and-npm v24.12.0 npm install npm webpack build webpack generate-resources --mode production src/main/frontend target/classes/static ``` -------------------------------- ### Install Node.js and pnpm with Maven Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt This Maven configuration installs Node.js and the pnpm package manager locally. pnpm is known for its speed and disk-space efficiency. The plugin downloads the specified versions of Node.js and pnpm, enabling their use within the Maven build lifecycle for frontend development. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 target install node and pnpm install-node-and-pnpm v24.12.0 v10.26.1 ``` -------------------------------- ### Install Frontend Maven Plugin Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Add the frontend-maven-plugin to your Maven project's pom.xml file to enable Node.js and package manager integration. ```xml com.github.eirslett frontend-maven-plugin LATEST_VERSION ``` -------------------------------- ### Configure Node.js and Yarn installation Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Configures the plugin to use Yarn as the package manager instead of npm. It supports custom download roots for both Node.js and Yarn binaries. ```xml install node and yarn install-node-and-yarn generate-resources v24.12.0 v0.16.1 http://myproxy.example.org/nodejs/ http://myproxy.example.org/yarn/ ``` -------------------------------- ### Execute Bower Dependencies Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Maven configuration to run bower install, which places dependencies into the bower_components directory. ```xml bower install bower install ``` -------------------------------- ### Execute npx Binaries Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt Configures the plugin to execute npm package binaries via npx. Useful for running tools without requiring them to be installed as local project dependencies. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 target install node and npm install-node-and-npm v24.12.0 11.6.2 npx cowsay npx -y cowsay@1.6.0 hello ``` -------------------------------- ### Execute Yarn Commands Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Configures the plugin to run yarn commands, such as installing dependencies, during the Maven build process. ```xml yarn install yarn install ``` -------------------------------- ### Running Karma Tests with Frontend Maven Plugin Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Configures the frontend-maven-plugin to execute Karma tests. It specifies the execution goal as 'karma' and allows customization of the Karma configuration file path. This setup is typically used within the 'test' Maven phase. ```xml javascript tests karma test src/test/javascript/karma.conf.ci.js ``` -------------------------------- ### Configure custom download roots and authentication Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Demonstrates how to specify separate download repositories for Node.js and npm, including using server credentials from the Maven settings file. ```xml http://myproxy.example.org/nodejs/ server001 https://myproxy.example.org/npm/ ``` -------------------------------- ### Execute npm Commands Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt Demonstrates how to run standard npm commands like ci, test, and build within the Maven lifecycle. It supports custom registry URLs and proxy configuration overrides. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 install node and npm install-node-and-npm v24.12.0 npm ci npm ci npm test npm test run test npm build npm run build https://registry.example.com/ false ``` -------------------------------- ### Configure Environment Variables for Node Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Demonstrates how to pass custom environment variables to Node.js executions, including support for static values and dynamic Maven properties. ```xml Snow Lannister ${NODE_ENV} ``` -------------------------------- ### Skip Frontend Plugin Goals (XML and Command Line) Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt Demonstrates how to skip specific goals of the frontend-maven-plugin during a Maven build. This can be achieved by configuring skip properties within the pom.xml or by using system properties on the command line. This helps in controlling which parts of the frontend build process are executed. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 install node and npm install-node-and-npm v24.12.0 npm install npm ``` -------------------------------- ### Configure Custom Working Directory Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt This snippet demonstrates how to set a specific working directory for the frontend project, ensuring the plugin looks for package.json in the correct subfolder. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 src/main/frontend install node and npm install-node-and-npm v24.12.0 11.6.2 npm ci npm ci ``` -------------------------------- ### Configure Grunt or Gulp Build Directories Source: https://github.com/eirslett/frontend-maven-plugin/wiki/Home Configures source and output directories along with trigger files for incremental builds in M2Eclipse. These settings help the plugin track changes to files like gulpfile.js or package.json. ```xml ${basedir}/src/main/frontend ${project.build.directory}/frontend gulpfile.js package.json ``` -------------------------------- ### Running Webpack Build with Frontend Maven Plugin Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Configures the frontend-maven-plugin to execute a Webpack build. The goal is set to 'webpack', and it can accept arguments for the Webpack command, such as '-p' for production builds. This is often run during the 'generate-resources' phase. ```xml webpack build webpack generate-resources -p ``` -------------------------------- ### Configure Plugin for Maven 2 Compatibility Source: https://github.com/eirslett/frontend-maven-plugin/wiki/Home Shows how to configure the plugin for use with Maven 2 by pinning the version to 0.0.22 and adding a dependency on plexus-utils. ```xml com.github.eirslett frontend-maven-plugin 0.0.22 org.codehaus.plexus plexus-utils 2.1 ``` -------------------------------- ### Configure Corepack with frontend-maven-plugin Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt Explains how to use Corepack to manage package manager versions defined in the project's package.json file. It demonstrates running Yarn and pnpm commands through the Corepack goal. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 target install node and corepack install-node-and-corepack v24.12.0 yarn install via corepack corepack yarn install --no-immutable pnpm build via corepack corepack pnpm build ``` -------------------------------- ### Execute Gulp Tasks Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Configuring the plugin to run Gulp tasks defined in gulpfile.js during the generate-resources phase. ```xml gulp build gulp generate-resources build ``` -------------------------------- ### Execute Package Managers with Corepack Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Configuring the frontend-maven-plugin to execute Yarn or pnpm commands using Corepack. ```xml install corepack yarn install ``` -------------------------------- ### Configuring Working Directory for Frontend Maven Plugin Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Sets a custom working directory for the frontend-maven-plugin. This is useful when frontend files (like package.json, Gruntfile.js, or gulpfile.js) are located in a subdirectory other than the project's base directory. The default is the project's root. ```xml com.github.eirslett frontend-maven-plugin src/main/frontend ``` -------------------------------- ### Configure Test Failure Handling (XML) Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt Configure the frontend-maven-plugin to control how test failures are handled during the Maven build. By setting `testFailureIgnore` to `true`, the build will continue even if frontend tests fail. This is useful for development or when test results do not block the entire build process. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 install node and npm install-node-and-npm v24.12.0 npm test npm test run test true ``` -------------------------------- ### Execute Grunt Tasks Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Configuring the plugin to run Grunt tasks defined in Gruntfile.js during the generate-resources phase. ```xml grunt build grunt generate-resources build ``` -------------------------------- ### Pass Environment Variables to Frontend Commands (XML) Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt Configure the frontend-maven-plugin to pass custom environment variables to frontend build commands. This is useful for setting build-specific configurations like API endpoints or build numbers. Dependencies include the plugin itself and the Maven build environment. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 install node and npm install-node-and-npm v24.12.0 npm build npm run build production ${api.url} ${build.number} ``` -------------------------------- ### Pass Environment Variables to Build Tasks Source: https://github.com/eirslett/frontend-maven-plugin/wiki/Home Demonstrates how to inject custom environment variables into build tasks like gulp, grunt, or karma. These variables become accessible within the Node.js process via process.env. ```xml ${project.build.directory} ``` -------------------------------- ### Configure Karma Test Runner Source: https://context7.com/eirslett/frontend-maven-plugin/llms.txt This snippet shows how to integrate Karma unit tests into the Maven test lifecycle. It specifies a custom path for the Karma configuration file. ```xml com.github.eirslett frontend-maven-plugin 2.0.0 install node and npm install-node-and-npm v24.12.0 npm install npm javascript tests karma test src/test/javascript/karma.conf.ci.js ``` -------------------------------- ### Configure Yarn with Private Registry Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Commands to set a private registry for Yarn to ensure yarn.lock references internal modules, and the corresponding Maven plugin configuration. ```bash yarn config set registry yarn install ``` ```xml yarn install yarn install http://myregistry.example.org/ ``` -------------------------------- ### Importing Dependencies and Modules in JavaScript Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/frontend-maven-plugin/src/it/example project/index.html This snippet shows how to import the jQuery library and a custom local module. It then uses the imported square function to update the text content of the document body. ```javascript import $ from "jquery"; import { square } from "./src/main/javascript/square.js"; $(document.body).text(square(5)); ``` -------------------------------- ### Disable Proxy Inheritance for Package Managers Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Configures the plugin to prevent npm, bower, or yarn from inheriting proxy settings from the Maven configuration. This is useful when specific tools cannot access resources through the configured proxy. ```xml false ``` ```xml false ``` ```xml tests yarn compile false run test ``` -------------------------------- ### Ignore Test Failures Source: https://github.com/eirslett/frontend-maven-plugin/blob/master/README.md Configures a specific execution to ignore test failures, allowing the Maven build to continue even if the frontend tests fail. ```xml true ```