This documentation is not maintained. Please refer to doc.castsoftware.com/technologies to find the latest updates.

Extension ID

com.castsoftware.dmtjeegradlediscoverer

What's new?

Please see Gradle Project Discoverer - 1.0 - Release Notes for more information. 

CAST AIP Compatibility

AIP Console≥ 1.16.x
CAST Delivery Manager Tool≥ 8.3.11

What is discovered?

The Gradle Project Discoverer detects Gradle Java projects (single as well multimodule) on the basis of *.gradle files present in the Application. The extension considers the following project build files to discover corresponding Gradle Java projects:

  • "settings.gradle"
  • "build.gradle"
  • "dependency.gradle" (any external file that is imported in build.gradle using apply from)

In addition, the discoverer will only detect Gradle Java projects as well as Gradle android projects therefore the corresponding .gradle file must contain Java or Maven as plugin, in either format mentioned below.

apply plugin: 'java'

or

apply plugin: 'maven'

or

apply plugin: '%android%'

plugins
{
	id : 'java'
}

or

plugins
{
	id : 'maven'
}

In what situation should you install this extension?

When you want to discover and select all the Gradle projects from your source code. The extension reads all the projects based on their respective *.gradle file.

Exclusion rules

The following exclusion rules are provided:

Exclusion RuleBehaviorBy-default Behavior
ExclusionRuleJavaPreferGradleToEclipsePrefer Gradle Project over Eclipse Project for the same projectTrue
ExclusionRuleJavaPreferGradleToMavenPrefer Gradle Project over Maven Project for the same projectTrue
ExclusionRuleJavaPreferMavenToGradlePrefer Maven Project over Gradle Project for the same projectFalse
ExclusionRuleJavaPreferEclipseToGradlePrefer Eclipse Project over Gradle Project for the same projectFalse


These options are exposed in the CAST Delivery Manager Tool (but not in AIP Console):

Delivery messages

The following messages emitted by the discoverer may appear during the source code delivery:

FormatMessage IdMessageRemediation
Errorcast.dmt.discover.jee.gradle.missingLanguageMissing language %PATH%. Invalid extension.Check if in the bug fix of the extension and update it.
Errorcast.dmt.extend.discover.jee.gradle.project.parseError%FILE_PATH% .Invalid Fileerror while parsing the file. Correct the corresponding file.
Errorcast.dmt.discover.jee.gradle.getApplyFromURLContent.ExceptionInURLAccessURL%applyFromURL% PROJECT%PROJECT%exception while accessing the file mentioned in tag applyFromURL
Infocast.dmt.discover.jee.gradle.buidProjectStartStart processing of project %PATH%This is information only message.
Infocast.dmt.discover.jee.gradle.buidProjectEndEnd processing of project %PATH%This is information only message.
Infocast.dmt.discover.jee.gradle.buidProjectStartStart re-parsing of project %PATH%This is information only message.
Infocast.dmt.discover.jee.gradle.buidProjectEndEnd re-parsing of project %PATH%This is information only message.
Infocast.dmt.discover.jee.gradle.DiscoveredJavaProject

discovered plugins in build.gradle

This is information only message.
Infocast.dmt.extend.discover.jee.gradle.project.parseApplyFromURLFILE_PATH %filepath%This is information only message.
Infocast.dmt.extend.discover.jee.gradle.project.parseIncludedFile File Not Parsed!!!PATH %filepath%IncludedFile is not parsed. check the file
Warningcast.dmt.discover.jee.gradle.IgnoredProject missing java plugin in build.gradleCheck if corresponding build.gradle has plugin as java
Warningcast.dmt.discover.jee.gradle.parser.GradleProjectParserbuild.gradle is EmptyCheck if corresponding build.gradle is empty. Impact : The particular module with empty build.gradle file will not be discovered
Warningcast.dmt.discover.jee.gradle.parser.GradleSettingParsersettings.gradle is EmptyCheck if settings.gradle is empty
Warningcast.dmt.extend.discover.jee.gradle.project.parseIncludeFiles.IncorrectFileIncludedFile is EmptyCheck if includedFile is empty

Results after using the discoverer

Gradle Java projects will be selected by default - example shown for the CAST Delivery Manager Tool:

Notes

src/main/java directory

Gradle defines the directory src/main/java as the default source directory for compilation (reference: https://docs.gradle.org/current/userguide/organizing_gradle_projects). Therefore, the Gradle extension works in exactly the same way, it will add the src/main/java as the default source directory if no source directories are explicitly mentioned in the build.gradle file within the sourceSet block.

As a result of this, there may be scenarios where we do not have src/main/java folder for project modules structure but still it shows src/main/java as source directory in discovery files, if discovered. In these scenarios, the discovered Gradle modules will be shown as "Deactivated" in AIP Console.

Required Maven repositories

Contrary to pure Maven projects, Maven repositories used by Gradle projects will not be fetched and included by default, therefore, if your Gradle project uses any Maven repositories, you must ensure that these repositories are delivered manually.