How to run single task from multiple tasks?

Hello Guys,

I have 10 tasks in my project but I want to run only one task from them when I fire a command like gradle <task_name> then it should run only that task but it runs all the tasks present in my grade script. I want to create a Jenkins job for the same. and in Jenkins job same problem occers.

can anyone help me out

Hard to guess without you showing your actual build script.
But my suspicion is, that you do not do your work in the execution phase but in the configuration phase and additionally do not leverage the task configuration avoidance. The former being a major error, the latter “just” a bad practice.

I suspect so, because you already answered your actual question. While you should practically never use gradle, but always the Gradle wrapper gradlew, giving the task name is perfectly fine and if that task does not depend on the others, they will not be executed. You can also look at a build scan using --scan parameter to gather more insight on what happened in your build run.