7.1.5. >Importing Java Modules Using a Gradle Project

You can import Gradle projects as modules into an existing Sonargraph project or while creating a new system.

To create a new Sonargraph system from a Gradle project, use "File""New""System""New Java System Based On Gradle Project" .

To import Gradle projects as modules directly into an already existing Sonargraph system use "File""New""Module""Java Modules from Gradle Project" .

Select the location of the Gradle project directory you want to import projects from. You can choose those projects and root directory paths that should be imported and those that should not. The imported Gradle projects become modules in the Sonargraph workspace.

In the 'Options' section of the import dialog, the naming of the to be created Sonargraph modules can be configured. There are three possibilities: Either 'Unique Identifier', 'Group and Name', or 'Name only'.

Decide if you also want test sources, generated sources, or empty projects to be imported.

If your gradle build needs a different Gradle user home, a specific Gradle version, or a local Gradle installation to be built successfully, it can be set in the 'Gradle Configuration' section of the Gradle import dialog.

NOTE

The Gradle version to be used for the import is determined in the following order:

  • If option 'Gradle version' is set, this version is taken.

  • If option 'Gradle installation' is set, this installation of Gradle is used.

  • If neither 'Gradle version', nor 'Gradle installation' are given, and the Gradle project contains a Gradle wrapper, the Gradle version configured by the wrapper is taken.

  • If neither 'Gradle version', nor 'Gradle installation' are given, and the Gradle project contains no Gradle wrapper, Gradle version 7.3 is taken by default.

Importing Java modules using a Gradle project
Figure 7.5. Importing Java Modules Using a Gradle project

Sonargraph will let you know about content that is already in the software system , empty or irrelevant directory paths and dependencies between modules.