Run IntelliJ Java main method without Gradle build

If you have a Gradle project in Idea IntelliJ IDE and you want to run a simple Java class with the main method just like a standalone java application without Gradle kicking off the build process (can take up a lot of time when you are having multi-project dependencies), follow the below steps,

  1. Go to Menu: View -> Tool Windows -> Gradle,
    View - Tool Window - Gradle Option
  2. Now, Click on the gear icon and select: Gradle Settings..
    Gradle Settings
  3. Now under Build and run select Build and run using IntelliJ IDEA instead of Gradle (default)
    Build and run using IntelliJ IDEA

Now when you will run your Java main method the Gradle build will not happen and your execution will be super quick!

Try Out Code2care Dev Tools:


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.