cds:install-node

Full name:

com.sap.cds:cds-maven-plugin:3.4.0:install-node

Description:

Download a Node.js distribution and install it on the local file system.
If the requested version is already installed, the download and installation is skipped.

This goal also considers proxy configurations in the ~/.m2/settings.xml. If there's an active proxy for the host in the downloadUrl configured, it is used.

The goal also supports basic authentication at the downloadUrl. The optional parameter serverId can be used to reference a server configuration from settings.xml, which provides username and password. See also Settings Reference for further details about server configuration in settings.xml.

Once executed, this goal exposes the following locations as project properties:

  • ${cds.node.executable}: Location of the node executable
  • ${cds.npm.executable}: Location of the npm executable
  • ${cds.npx.executable}: Location of the npx executable
  • ${cds.node.directory}: Directory containing the Node.js executables (node/npm/npx), can be used to enhance the $PATH environment variable
If the goal is skipped, the properties are set to the globally available executables: node, npm and npx.

Attributes:

  • Executes as an aggregator goal.
  • The goal is not marked as thread-safe and thus does not support parallel builds.
  • Since version: 1.7.0.
  • Binds by default to the lifecycle phase: initialize.

Required Parameters

Name Type Since Description
<downloadUrl> String - Define the download URL of the Node.js distribution.
Default: https://nodejs.org/dist/
User Property: cds.install-node.downloadUrl
<nodeVersion> String - Define the Node.js version requested for installation.
IMPORTANT: The Node.js version has to start with 'v', for example 'v16.18.1'.
Default: v20.17.0
User Property: cds.install-node.nodeVersion

Optional Parameters

Name Type Since Description
<downloadRetries> int 2.4.0 The number of retries to download the Node.js distribution.
Default: 3
User Property: cds.install-node.downloadRetries
<force> boolean - Force download and installation of Node.js, even if it's already installed.
Default: false
User Property: cds.install-node.force
<installDirectory> File - Location of the target installation directory. If this parameter isn’t specified, the Node.js distribution is installed into a directory within the local Maven repository: ~/.m2/repository/com/sap/cds/cds-maven-plugin/cache/...
User Property: cds.install-node.installDirectory
<serverId> String 1.29.0 Define a server identifier that points to a server configuration in settings.xml which provides the username and password used for basic authentication.
User Property: cds.install-node.serverId
<skip> boolean - Skip execution of this goal.
Default: false
User Property: cds.install-node.skip

Parameter Details

<downloadRetries>

The number of retries to download the Node.js distribution.
  • Type: int
  • Since: 2.4.0
  • Required: No
  • User Property: cds.install-node.downloadRetries
  • Default: 3

<downloadUrl>

Define the download URL of the Node.js distribution.
  • Type: java.lang.String
  • Required: Yes
  • User Property: cds.install-node.downloadUrl
  • Default: https://nodejs.org/dist/

<force>

Force download and installation of Node.js, even if it's already installed.
  • Type: boolean
  • Required: No
  • User Property: cds.install-node.force
  • Default: false

<installDirectory>

Location of the target installation directory. If this parameter isn’t specified, the Node.js distribution is installed into a directory within the local Maven repository: ~/.m2/repository/com/sap/cds/cds-maven-plugin/cache/...
  • Type: java.io.File
  • Required: No
  • User Property: cds.install-node.installDirectory

<nodeVersion>

Define the Node.js version requested for installation.
IMPORTANT: The Node.js version has to start with 'v', for example 'v16.18.1'.
  • Type: java.lang.String
  • Required: Yes
  • User Property: cds.install-node.nodeVersion
  • Default: v20.17.0

<serverId>

Define a server identifier that points to a server configuration in settings.xml which provides the username and password used for basic authentication.
  • Type: java.lang.String
  • Since: 1.29.0
  • Required: No
  • User Property: cds.install-node.serverId

<skip>

Skip execution of this goal.
  • Type: boolean
  • Required: No
  • User Property: cds.install-node.skip
  • Default: false