Lets us learn few more things in Gradle....
How to update Project name and description?
- To update Project name, user can change/update the project name by creating settings.gradle file in root project which specifies the project name.
rootProject.name="GradleDemoProject"
- To update description, user can update/add description in your project in build.gradle file, open build.gradle file and below line at top of the file
description=""" Hello user, this project is to understand gradle key features Project Name : ${project.name} “""
How to apply plugin in build.gradle file?
- Plugins is extension to your gradle project which adds some preconfigured tasks.
- Add below statement in build.gradle file
Syntax: apply plugin : 'pluginname'
Example: apply plugin : 'java'
How to add comments in Gradle file?
Similarly like Java, we can use single & multi line comments in gradle file. The syntax are belowSyntax: //Single line comments use two back slash /* Multi line comments */
How to manage/add dependency in gradle?
User can add project dependencies in build gradle, For example, user add all third party jars in lib folder under root of your gradle project.
dependencies { compile fileTree(dir: 'lib', include: ['*.jar’]) }
How to add Task dependencies?
task clean1 { doLast { println 'Executing the clean task' } } task compile { doLast { println 'Executing the compile task' } } task run { doLast { println "I am running script....." } } run.dependsOn clean1, compile