'execute before make' runs even if mvn module not being made?

I have a multi-module maven3-based project where module webui depends on core. In Maven Projects view I enabled Execute Before Make for maven phase generate-sources of module core. Works as advertised when I make entire project. But also this mvn generate-sources (on core) goal also gets invoked if I "Make Module webui" - which is surprising since core need not be re-build to build webui. Shouldn't execute before/after make flag be honored only if the module in which it is set is actually being made? If that's not the designed behavior, any suggestions for a hack to emulate it?

thank you,
-nikita

6 comments
Comment actions Permalink

'Make' a module means that this module and all modules it depends on (transitively) must be 'made'. So although you click to make module 'webui', module 'core' is also made and thus all 'before make' tasks are executed. This is by design.
Probably you can try 'compile module webui' action istead from context menu (personally I think that 'compile' is incorrect name of the action and its real sense is 'rebuild module'). The difference of 'make module' and 'compile module' is the following:
- 'Make' is incremental, 'Compile' is not. If you have 'clear output directory on rebuild' option checked - 'compile module' will clear corresponding module output.
- 'Make' respects module dependencies, 'Compile' - not. So if you select to compile module webui - module core output may remain not up-to-date if any changes were made after previous compilation.

0
Comment actions Permalink

Thanks for your response and clarifying distinction between compile and make, Alexander. (I agree that the latter should be 'rebuild' - certainly my assumption was that compile would only compile out-of-date classes - not everything)

"'Make' a module means that this module and all modules it depends on (transitively) must be 'made'. So although you click to make module 'webui', module 'core' is also made and thus all 'before make' tasks are executed. This is by design."

OK, that makes sense. However, the behavior I am seeing is more like "before make tasks attached to any module run every time Make is invoked any one module in the project, or the entire project". While the latter may make sense (not sure), the former does not:
- I have another module - gui - in the same project
- gui depends on webui (which, recall, depends on core)
- there is a 'before task' attached to gui
- when I make module webui, gui's task is also executed. why?

Lasty, what is the intended logic wrt to 'before make' on a module when make project is invoked:
1) invoke only if module is acutally made?
2) how does make project decide whether to make an individual module? (compares date modified of .java v. class files? all files? something else?)

Thanks,
-nikita

0
Comment actions Permalink

When the whole project is 'made' all modules are 'made'. As it is incremental 'make module' may result in nothing really done (if all classes are up-to-date), but anyway the modue is considered as being 'made' so all 'before make' tasks are executed. I think the logic is like this.

I think you are right and 'before make' tasks for 'gui' module shouldn't be executed when you make 'webui'. Please open corresponding request in the issue tracker.

0
Comment actions Permalink

See http://youtrack.jetbrains.com/issue/IDEA-93701

What's your process for triaging issues like this one? (I ask because I saw a number of issues that linger without any updates for 12+ months - so would like to calibrate my expectations).  thank you.

0
Comment actions Permalink

We pay more attention to issues that affect a lot of users (i.e. have a lot of votes). You may comment how critical is the issue to you and your team.

0
Comment actions Permalink

OK, thanks. Hopefully you weigh paying users' votes differently ;-

0

Please sign in to leave a comment.