Make 'gradle tasks' to only show specific tasks

What is the easiest way to make ‘gradle tasks’ to only show tasks that I defined in my script?

One way I can think of is to do tasks.each { } at the very start of the script and then my tasks’ group appropriately.

Is there a better way?

At the moment you cannot filter the output of the tasks task. Checking for a null value for group doesn’t necessarily indicate that the task has been defined by your project. Other plugins can bring in tasks that do not define a task.

What’s the specific use case you want to solve? Maybe you want to easily discover tasks that you use very often. In those cases I’d assign a specific, known group.

You are correct that I want to show tasks that developers use often.
Utimately I want to make life easier for them by hiding tasks that are not relevant to their day-to-day job, i.e.: javadoc, components, init, and even build (i created a new task around build that will deploy exploded war locally and do it in incremental fashion).

At the moment there’s no good way to hide existing tasks in the tasks output (apart from using null group but that doesn’t apply to tasks provided by the Java plugin). I’d introduce so-called life cycle tasks, tasks that users execute on a regular basis. Those tasks just depend on other tasks and don’t have a task action. For those tasks I’d add a specific group.

On top of that, writing some documentation and making it available to the team might help. The problem with documentation is though that you have to keep it in sync with the code.