fall
fall

Reputation: 1182

How to run a main method method without building the WHOLE maven project in idea?

I have a maven project with many demo classes with their own main methods, they don't dependent on each other. I used to be able to run a class by right clicking on its main method, and select Run MyClass.main(). But now instead of running it, it started to build the maven project as a whole.

enter image description here

Is there a way to "fix" this?

Upvotes: 2

Views: 1742

Answers (2)

Andrey
Andrey

Reputation: 16381

IDE performs tasks that are set in Before launch section of the Run/Debug Configuration. By default the Build set is set there - which will build the all the sources which deletd on the code you are trying to run.

  1. You can remove the Build step from there and build the module alone from the module context menu of this module. See compile module for more description.
  2. Use Build, no error check step in Before launch section.

Upvotes: 2

Abacus
Abacus

Reputation: 19421

Check that in the settings the "Delegate IDE build..." is not selected:

project settings

Upvotes: 1

Related Questions