Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to mvn clean install everytime I change .java code [closed]

Tags:

spring

maven

I have a maven based multimodule project of angular and spring boot running in my local machine and whenever I change code of spring boot, I need to run mvn clean install to reflect changes. How do I solve it out. Any kind of help is appreciated

like image 263
Sabin Shrestha Avatar asked Feb 19 '26 23:02

Sabin Shrestha


1 Answers

Assuming, you change the code in the IDE, you don't really have to run mvn clean install after each and every single change. Instead you can rely on the IDE that is supposed to maintain the model of the project (created out of pom.xml) when you open the project. The IDE keeps track on the relevant files, that must be recompiled after the changes. Usually its only a small fraction of the whole codebase.

I personally run maven locally after I do significant changes (like before pushing the change upstream).

Even if we do I suggest you to consider the following optimizations:

  • you don't have to run the clean install on all the project, instead you can mvn clean install -pl :<your-module>.
  • Also you don't have to run tests upon each change (ok, maybe you do want to do so, but its your decision).
  • If you do run multi module build, you don't have to run clean because when you do, it will remove the target folder and recompile the project. If, however you don't run clean some modules that don't really have changes maven will recognize that and won't really recompile the module. ---- Other options include --also-make option that will filter the modules for the compilation that can be used in conjunction with -pl option.
like image 164
Mark Bramnik Avatar answered Feb 21 '26 15:02

Mark Bramnik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!