Package com.sap.cds.maven.plugin.build
Class InstallNodeMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
com.sap.cds.maven.plugin.AbstractCdsMojo
com.sap.cds.maven.plugin.build.InstallNodeMojo
- All Implemented Interfaces:
CdsMojoLogger,org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="install-node",
defaultPhase=INITIALIZE,
aggregator=true,
requiresProject=false)
public class InstallNodeMojo
extends AbstractCdsMojo
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
The goal also supports basic authentication at the
Once executed, this goal exposes the following locations as project properties:
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
nodeexecutable - ${cds.npm.executable}: Location of the
npmexecutable - ${cds.npx.executable}: Location of the
npxexecutable - ${cds.node.directory}: Directory containing the Node.js executables (node/npm/npx), can be used to enhance the $PATH environment variable
- Since:
- 1.7.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected org.eclipse.aether.RepositorySystemSessionDefines settings and components that control the repository system.Fields inherited from class com.sap.cds.maven.plugin.AbstractCdsMojo
buildContext, CDS_SERVICES_GROUPID, mojoExecution, PLUGIN_KEY, project, session, settingsFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()protected voidexecute(File workDir, File execFile, OutputStream outputStream, Map<String, String> additionalEnv, int[] exitValues, String... args) Executes a program as child process.protected FileFinds the cds working directory by going upwards and looking for a .cdsrc.json file.Methods inherited from class com.sap.cds.maven.plugin.AbstractCdsMojo
ensureCliExecuted, findGoalExecution, findSrvProject, getReactorBaseDirectory, isCliExecuted, logDebug, logDebug, logError, logError, logError, logInfo, logWarn, logWarn, logWarn, scanDirectory, setProperty, strongMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
DEFAULT_NODE_VERSION
- See Also:
-
PROP_NODE_DIR
- See Also:
-
PROP_NODE_EXECUTABLE
- See Also:
-
PROP_NPM_EXECUTABLE
- See Also:
-
PROP_NPX_EXECUTABLE
- See Also:
-
PARAM_NODE_DIR
- See Also:
-
PARAM_NPX_EXECUTABLE
- See Also:
-
PARAM_NPM_EXECUTABLE
- See Also:
-
repositorySystemSession
@Parameter(defaultValue="${repositorySystemSession}", required=true, readonly=true) protected org.eclipse.aether.RepositorySystemSession repositorySystemSessionDefines settings and components that control the repository system.
-
-
Constructor Details
-
InstallNodeMojo
public InstallNodeMojo()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
execute
protected void execute(File workDir, File execFile, OutputStream outputStream, Map<String, String> additionalEnv, int[] exitValues, String... args) throws IOExceptionExecutes a program as child process.- Parameters:
workDir- the working directory of child processexecFile- the executable to useoutputStream- an optional standard output streamadditionalEnv- additional environment variables, can benullexitValues- an optional list with exit values of the process to be considered successful, can benullargs- an optional command line arguments passed to the process- Throws:
IOException- if an I/O exception occurredorg.apache.commons.exec.ExecuteException- if process execution failed
-
findCdsWorkingDir
Finds the cds working directory by going upwards and looking for a .cdsrc.json file. It stops at the top-most project directory.- Returns:
- the cds working directory or
nullif not found.
-