JAVA EXAMPLE PROGRAMS

JAVA EXAMPLE PROGRAMS

Publish Your Article Here

How to list all gradle tasks?


You can use gradle tasks to list the tasks of a project. This will let you see the tasks that the Java plugin has added to your project. Here is a simple build.gradle file for an example:

defaultTasks 'clean', 'run'
						
task clean << {
        println 'Default Task - Cleaning!'
}
task run << {
        println 'Default Task - Running!'
}
task mySpecTask << {
        println "I'm not a default task!"
}

Run "gradle tasks"

java2novice$ gradle tasks
:tasks

------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------

Default tasks: clean, run

Build Setup tasks
-----------------
init - Initializes a new Gradle build. [incubating]
wrapper - Generates Gradle wrapper files. [incubating]

Help tasks
----------
components - Displays the components produced by root project 'gradle_tests'.
dependencies - Displays all dependencies declared in root project 'gradle_tests'.
dependencyInsight - Displays the insight into a specific dependency in root 
					project 'gradle_tests'.
help - Displays a help message
projects - Displays the sub-projects of root project 'gradle_tests'.
properties - Displays the properties of root project 'gradle_tests'.
tasks - Displays the tasks runnable from root project 'gradle_tests'.

Other tasks
-----------
clean
mySpecTask
run

To see all tasks and more detail, run with --all.

Reference: Gradle Documentation

<< Previous Program | Next Program >>

Gradle configuration examples

  1. Gradle Installation Steps
  2. What is gradle project and task
  3. What is build.gradle file?
  4. How to avoid gradle log messages?
  5. How to define default tasks in Gradle?
  6. How to list all gradle tasks?
  7. How to list gradle project properties?
  8. How to declare a task that depends on other task?
  9. How to create dynamic tasks in Gradle?
  10. How to exclude a task in gradle?
  11. How to create java project in gradle?
Knowledge Centre
What is abstract class or abstract method?
We cannot create instance for an abstract class. We can able to create instance for its subclass only. By specifying abstract keyword just before class, we can make a class as abstract class.

public abstract class MyAbstractClass{

}

Abstract class may or may not contains abstract methods. Abstract method is just method signature, it does not containes any implementation. Its subclass must provide implementation for abstract methods. Abstract methods are looks like as given below:

public abstract int getLength();
Famous Quotations
If you don’t make mistakes, you’re not working on hard enough problems. And that’s a big mistake.
-- Frank Wilczek

About Author

I'm Nataraja Gootooru, programmer by profession and passionate about technologies. All examples given here are as simple as possible to help beginners. The source code is compiled and tested in my dev environment.

If you come across any mistakes or bugs, please email me to [email protected].

Most Visited Pages

Other Interesting Sites

Reference: Java™ Platform Standard Ed. 7 - API Specification | Java™ Platform Standard Ed. 8 - API Specification | Java is registered trademark of Oracle.
Privacy Policy | Copyright © 2022 by Nataraja Gootooru. All Rights Reserved.