IQ for IDEA

Overview

IntelliJ IDEA is a fully featured integrated development environment (IDE) used for Java development. WebStorm is an IDE for the JavaScript ecosystem.

Component analysis is supported in these tools as shown in the table below.

Development EnvironmentJava Component AnalysisNode.js Component Analysis
IDEA Ultimate(tick)(tick)
IDEA Community(tick)(minus)
WebStorm(minus)(tick)

Installing IQ for IDEA

Sonatype Nexus IQ plugin is available for download on the JetBrains marketplace or via Sonatype Plugin Download Link.

IQ for IDEA supports installation via a zip file from disk. Installation is performed similarly to other plugins, using the Settings/Preferences dialog. Click on Plugins from the left-hand pane to expose the option to install plugin from disk. From there, browse to the plugin zip file and select it.

Remember to restart IntelliJ IDEA before continuing to access the plugin.

Configuring IQ for IDEA

After the successful installation of IQ for IDEA, the plugin must be configured to connect to IQ Server. The configuration can be accessed via the Settings/Preferences dialog. Expanding Other Settings in the left hand pane will reveal Nexus IQ. Click on Nexus IQ to set up the plugin for IQ Server.

  • Server URL: Enter the URL of IQ Server
  • Authentication Method:
    • PKI Authentication: Delegate authentication to the JVM.
    • User Authentication: Enter the username and password your IQ Server Administrator has assigned you.

      You will be prompted for your Master Password (or to set up a Master Password) when saving the Preferences/Settings. This allows IDEA to store your IQ Server password securely.

Once the IQ Server information is provided, click Connect to verify the connection to IQ Server. If it works, select an Application from the dropdown. The policies for the application will be used when evaluating your IDE project.

If Connect reports an HTTP error:

  • check your HTTP Proxy Server configuration. If the IQ Server URL is for an internal host name, the IQ server host may need to be added to the No proxy for list of patterns.
  • verify IQ Server request.log shows that your Connect requests have actually reached IQ Server. If they have, the IQ Server clm-server.log may contain more information.

Using the Component Info View

The IQ for IDEA tool window can be accessed by clicking the Nexus IQ tab on the bottom tool strip of IDEA. If not accessible from there, it should also be available in View under Tool Windows.

Once configured and the component analysis is completed a component view will look similar to the example is shown in the image below. The list of components will reflect an analysis of the project’s dependencies. For Java projects that includes all project libraries. For JavaScript projects it includes all dependent Node modules. For mixed projects, which combine Java and JavaScript modules the component list will contain both Java and JavaScript dependencies.

By default, all project dependencies are included in the component list. Scope filters can be applied to adjust which components are visible.

The following scopes are available:

  • for Java components: Compile, Test, Runtime, and Provided;
  • for JavaScript/Node components: Production, and Development.

Right-clicking on any component will bring up a menu of actions. Java and JavaScript projects should allow for the following: View Details, and Find Usages. Maven-based Java projects add an extra entry: Open Maven POM.

  • View Details will open the details screen providing more context to the component.
  • Find Usages will bring up a list of every module the component is used in. Clicking on a module will bring up the location where the component is declared, which is either a Maven POM file, or a package.json file.
  • Open Maven POM will open the Maven POM of the component selected.

Please go to the Component Info View page to find more details on the available information and how it can be used to remediate policy violations.

Troubleshooting Load Components

Java Projects

In case of Maven or Gradle based projects, when a project is first opened in the IDE, it is possible that it was not imported for the project type (maven or gradle). The symptom for this condition is an empty External Libraries folder in the project view:

The project (i.e. its manifest files) must be imported to get the list of External Libraries to appear. For Maven projects, locate the root pom.xml file, right-click, then select Maven → Reload project:

NOTE: For Gradle projects locate the build.gradle file, right-click, then select Reload from disk.

This will convert the project to its proper type which will load the External Libraries:

Now, you can click on the Evaluate Components button and the analyzed components will load in the Nexus IQ Component View:

The evaluation results will look something like this:

JavaScript Projects

JavaScript projects must be set up in the IDE as Node projects. This can be configured by navigating to File  Settings...  Language & Frameworks  Node.js and NPM. The paths to the Node interpreter and the package manager must be valid (see below).

Migrating to Different Component Versions

For Java projects this feature relies on the project being Maven-based. For JavaScript projects this feature expects that the project is properly set up in the IDE as a Node project and that a package manager is available (i.e. npm, yarn or pnpm)

If you determine that a component upgrade is required to avoid a security or license issue or a policy violation, after reviewing your component usage, IQ for IDEA can be used to assist you in the necessary refactoring.

The first step to start the migration is to select a newer version for the component in the visualization chart, or by selecting the recommended version. An example is displayed in the image below:

Once you have selected a different version than the one currently used, the Migrate button will become active. Pressing the button completes the migration from the current component version to the selected component version, by updating the component version in the relevant manifest files.

For Maven-based Java projects the migration process is able to detect circumstances such as the component being a transitive dependency or versions managed in a property. For JavaScript projects only direct dependencies can be migrated.

After the migration is completed, the component list will be updated and a component scan will be initiated. You should perform a full build, as well as a thorough test, to determine that you can proceed with the new version in your development.

Typically, smaller version changes will have a higher chance of working without any major refactorings, or adaptations, of your code base and projects, while larger version changes potentially give you more new features or bug fixes.

Your release cycle, customer demands, productions issues, and other influencing factors will determine your version upgrade choices. You might decide a multi-step approach, where you do a small version upgrade immediately to resolve current issues and then work on the larger upgrade subsequently to get the benefits of using a newer version. Or, you might be okay with doing an upgrade to the latest available version straight away. Potentially, a combination of approaches in different branches of your source code management system is used to figure out the best way of going forward with the upgrade.

IQ for IDEA and other tools of the IQ Server suite can assist you through the process of upgrading, as well as monitoring, the applications after upgrade completion.

Upgrading to IntelliJ IDEA 2020.2 and above

If you are upgrading to IntelliJ IDEA 2020.2.x and above from IntelliJ IDEA 2020.1.x and below, you will need to install the new Nexus IQ IDEA Plugin version 3.x or above. If you had the Nexus IQ IDEA Plugin 2.x installed on IntelliJ IDEA 2020.1.x and below the Nexus IQ IDEA Plugin 2.x plugin will not be automatically updated or installed when you upgrade to IntelliJ IDEA 2020.2.x and above. Instead you will need to install the Nexus IQ IDEA Plugin 3.x from the JetBrains marketplace (recommeded) or from the Sonatype download site.

You might see a message like this when you start the IntelliJ IDEA 2020.2.x upgrade: