Implementing the Mend CLI in the IDE
Recommended Approach
The current recommended approach to execute a Mend Scan in an IDE is to run the Mend CLI from either a task, or in an integrated terminal. This allows users to run a scan and see any vulnerabilities or policy violations at will from within the Mend CLI. This approach favors giving developers information they need when wanted, as opposed to the IDE integrations which force a scan during any compilation process.
To do this, make sure the Mend CLI is downloaded to a directory that is a part of your PATH environment variable. Make sure to move the CLI to a directory that makes sense (i.e. C:\mend\cli
on Windows, or /usr/local/mend
on Linux/Mac OS) and then add it to your PATH environment variable.
To add the directory to your PATH environment variable, follow these steps:
After doing this, the CLI can be checked by running the mend
command in any terminal.
From there open your preferred IDE and continue with one of the preferred methods below:
Preferred Method 1: Running in an Integrated Terminal
To run in an integrated terminal, simply open a terminal window in your IDE, make sure that you are logged in with the command: mend auth info
. Then follow the instructions required for the type of scan desired:
Preferred Method 2: Running the Mend CLI as a task
To run a Mend SCA scan as a task in an IDE, configurations will have to occur.
SCA Scans or SAST scans can be run in the same exact way with these tasks, the only difference will be the commands used to run them:
SCA Scans -
mend dep
SAST Scans -
mend code --offline
NOTE: If --offline
is specified, then no data will be uploaded to the Mend UI, which also means that no specific data concerning the findings will be reported. Only the types of findings.
--offline still requires the user to have scan manager permissions. If the user is only has scan manager permissions to a specific application the --scope variable must be set i.e. --scope <application>//<project>. This will create a new project if the scope does not exist, no data will be uploaded.
Here are steps on how to set this up:
Native IDE Plugins
Using the Mend CLI in the IDE is recommended over the Native IDE Plugins due to the following reasons:
Language Support Restrictions based on the IDE
After the plugin is installed, it runs during every compile which takes extra development time.
The Plugins do not run the Mend CLI or Unified Agent, and therefore results can differ.
Here are the currently available IDE Plugins: