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 Rule | Behavior | By-default Behavior |
---|---|---|
ExclusionRuleJavaPreferGradleToEclipse | Prefer Gradle Project over Eclipse Project for the same project | True |
ExclusionRuleJavaPreferGradleToMaven | Prefer Gradle Project over Maven Project for the same project | True |
ExclusionRuleJavaPreferMavenToGradle | Prefer Maven Project over Gradle Project for the same project | False |
ExclusionRuleJavaPreferEclipseToGradle | Prefer Eclipse Project over Gradle Project for the same project | False |
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:
Format | Message Id | Message | Remediation |
---|---|---|---|
Error | cast.dmt.discover.jee.gradle.missingLanguage | Missing language %PATH%. Invalid extension. | Check if in the bug fix of the extension and update it. |
Error | cast.dmt.extend.discover.jee.gradle.project.parseError | %FILE_PATH% .Invalid File | error while parsing the file. Correct the corresponding file. |
Error | cast.dmt.discover.jee.gradle.getApplyFromURLContent.ExceptionInURLAccess | URL%applyFromURL% PROJECT%PROJECT% | exception while accessing the file mentioned in tag applyFromURL |
Info | cast.dmt.discover.jee.gradle.buidProjectStart | Start processing of project %PATH% | This is information only message. |
Info | cast.dmt.discover.jee.gradle.buidProjectEnd | End processing of project %PATH% | This is information only message. |
Info | cast.dmt.discover.jee.gradle.buidProjectStart | Start re-parsing of project %PATH% | This is information only message. |
Info | cast.dmt.discover.jee.gradle.buidProjectEnd | End re-parsing of project %PATH% | This is information only message. |
Info | cast.dmt.discover.jee.gradle.DiscoveredJavaProject | discovered plugins in build.gradle | This is information only message. |
Info | cast.dmt.extend.discover.jee.gradle.project.parseApplyFromURL | FILE_PATH %filepath% | This is information only message. |
Info | cast.dmt.extend.discover.jee.gradle.project.parseIncludedFile File Not Parsed!!! | PATH %filepath% | IncludedFile is not parsed. check the file |
Warning | cast.dmt.discover.jee.gradle.IgnoredProject | missing java plugin in build.gradle | Check if corresponding build.gradle has plugin as java |
Warning | cast.dmt.discover.jee.gradle.parser.GradleProjectParser | build.gradle is Empty | Check if corresponding build.gradle is empty. Impact : The particular module with empty build.gradle file will not be discovered |
Warning | cast.dmt.discover.jee.gradle.parser.GradleSettingParser | settings.gradle is Empty | Check if settings.gradle is empty |
Warning | cast.dmt.extend.discover.jee.gradle.project.parseIncludeFiles.IncorrectFile | IncludedFile is Empty | Check 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.