Page tree
Skip to end of metadata
Go to start of metadata

Extension ID

com.castsoftware.dmtjeegradlediscoverer

What's new?

Please see Gradle Project Discoverer - 1.1 - 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 following project types :

Java/Android projects built with Gradle (single as well multimodule)

Discovery is based on the presence of *.gradle files in the Application source code. The extension considers the following project build files to discover corresponding Gradle Java/Android projects:

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

Kotlin projects built with the Kotlin Gradle Plugin (single as well multimodule)

Discovery is based on the presence of *.gradle.kts files in the Application source code. The extension considers the following project build files to discover corresponding Gradle Java projects:

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

References required

All gradle / .gradle.kts files MUST contain at least one reference to the plugins listed below either using the apply plugin option or using the plugin command mentioned below.

\\apply plugin references:

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: '%android%'
apply plugin: 'application'
apply plugin: '%gradle%'
apply plugin: '%kotlin%'

\\plugin command references:

plugins
{
	id : 'java'
}

plugins
{
	id : 'maven'
}

plugins
{
	id : '%android%'
}

plugins
{
	id : 'application'
}

plugins
{
	id : '%gradle%'
}

plugins
{
	id : '%kotlin%'
}

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 or *.gradle.kts 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
Warningcast.dmt.discover.jee.gradle.ProjectWithNoNamemissing project name, keeping default project name as GradleJavaProjectCheck if the project name is missing in settings.gradle file. The particular project default name will be GradleJavaProject

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.

There is difference in the syntax for classic gradle and kotlin gradle project. Below is the official documentation for the same:
https://docs.gradle.org/current/userguide/migrating_from_groovy_to_kotlin_dsl.html

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. 

  • No labels