@Mojo(name="npm", defaultPhase=INITIALIZE, aggregator=true, requiresProject=false) public class NpmMojo extends AbstractCdsMojo
npm
command on the CAP Java project. For example, it can be used to perform an
npm install
to install npm dependencies which are maintained in package.json.mvn cds:npm -Darguments="..."
or mvn com.sap.cds:cds-maven-plugin:npm -Darguments="..."
to
execute npm
with given arguments.Modifier and Type | Field and Description |
---|---|
protected static String |
PARAM_NODE_DIR |
protected static String |
PARAM_NPM_EXECUTABLE |
protected static String |
PARAM_NPX_EXECUTABLE |
protected static String |
PROP_NODE_DIR |
protected static String |
PROP_NODE_EXECUTABLE |
protected static String |
PROP_NPM_EXECUTABLE |
protected static String |
PROP_NPX_EXECUTABLE |
protected org.eclipse.aether.RepositorySystemSession |
repositorySystemSession
Defines settings and components that control the repository system.
|
buildContext, CDS_SERVICES_GROUPID, mojoExecution, PLUGIN_KEY, project, session, settings
Constructor and Description |
---|
NpmMojo() |
Modifier and Type | Method and Description |
---|---|
void |
execute() |
protected void |
execute(File workDir,
File execFile,
OutputStream outputStream,
Map<String,String> additionalEnv,
int[] exitValues,
String... args)
Executes a program as child process.
|
protected void |
executeNpm(File workDir,
File outputFile,
String... args) |
protected String |
executeNpm(File workDir,
int[] exitValues,
String... args) |
protected String |
executeNpm(File workDir,
String... args) |
protected File |
findCdsWorkingDir()
Finds the cds working directory by going upwards and looking for a .cdsrc.json file.
|
ensureCliExecuted, findGoalExecution, findSrvProject, getReactorBaseDirectory, isCliExecuted, logDebug, logDebug, logError, logError, logError, logInfo, logWarn, logWarn, logWarn, scanDirectory, setProperty, strong
protected static final String PROP_NODE_DIR
protected static final String PROP_NODE_EXECUTABLE
protected static final String PROP_NPM_EXECUTABLE
protected static final String PROP_NPX_EXECUTABLE
protected static final String PARAM_NODE_DIR
protected static final String PARAM_NPX_EXECUTABLE
protected static final String PARAM_NPM_EXECUTABLE
@Parameter(defaultValue="${repositorySystemSession}", required=true, readonly=true) protected org.eclipse.aether.RepositorySystemSession repositorySystemSession
public void execute() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void executeNpm(File workDir, File outputFile, String... args) throws IOException
IOException
protected String executeNpm(File workDir, int[] exitValues, String... args) throws IOException
IOException
protected String executeNpm(File workDir, String... args) throws IOException
IOException
protected void execute(File workDir, File execFile, OutputStream outputStream, Map<String,String> additionalEnv, int[] exitValues, String... args) throws IOException
workDir
- the working directory of child processexecFile
- the executable to useoutputStream
- an optional standard output streamadditionalEnv
- additional environment variables, can be null
exitValues
- an optional list with exit values of the process to be considered successful, can be
null
args
- an optional command line arguments passed to the processIOException
- if an I/O exception occurredorg.apache.commons.exec.ExecuteException
- if process execution failedprotected File findCdsWorkingDir()
null
if not found.Copyright © 2023. All rights reserved.