-1

I have a maven modular project with the following build order.

common
core
third-party
services
web-app

Each module has its own pom.xml and the build order is included in the parent pom. So when I make any changes to common, should I only build common module or all the modules again to get the latest changes from common module?

happytohelp
  • 305
  • 3
  • 14
  • I was looking about whether I need to build all the projects again or just the one module that has changes than about the build order which was mainly discussed in the link provided – happytohelp Jan 12 '22 at 00:00
  • to save time: build only 1 module. – xerx593 Jan 12 '22 at 00:13
  • `package` builds "into target folder"(this might be enough for common IDEs), `install` into "local repo" (this is good! for all local dependants...built with maven.) – xerx593 Jan 12 '22 at 00:17
  • and yes, `install`ing (e.g.) commons only, would apply the changes to *all* its dependents built with local maven ( all...not only this project/module/parent). – xerx593 Jan 12 '22 at 00:21
  • 1
    Prefer `install` always to `package` (when you want other dependencies to notice the changes) ...but `package` build is the one, which you can `clean` (easy) ;) – xerx593 Jan 12 '22 at 00:27
  • First if your build order is only defined by the order in your parent then there is something wrong. You have to define dependencies between those modules which automatically results into the correct order...let Maven do that...not manually..And you should build from root location..to check if everything is correct. – khmarbaise Jan 12 '22 at 08:32
  • @xerx593 simply wrong. If you need `install` there is something wrong. `mvn package` is sufficient. If you like running integration tests use `mvn verify`. Using `mvn install` usually not needed. On a CI you use `mvn deploy` to deploy the results to repository manager... – khmarbaise Jan 12 '22 at 08:53
  • I am talking generally about "local dependencies", @khmarbaise, you must mean explicitly "inter-module-dependencies" ... where i (could be) simply (partially) wrong... – xerx593 Jan 12 '22 at 09:20
  • Even if you have local dependencies those should be handled via a repository manager. That means built on a CI solution and deployed to a repository manager (via CI) and no "mvn install" needed anymore ...much cleaner...And also prefer `install` always is even more wrong... – khmarbaise Jan 12 '22 at 09:35
  • @khmarbaise: for CI, you (normally) have "to push"!(?)And before push (i.e. locally): CI is in front of the keyboard, and `install` is the "repo manager", correct? – xerx593 Jan 12 '22 at 10:44
  • If you are locally you usually do it via your IDE not via Maven. CI is not in front of the keyboard... no `install` has nothing todo with the repo manager... – khmarbaise Jan 12 '22 at 10:47
  • ...yes, but if i don't have an IDE or a buggy/old IDE or too many (inter-dependent) projects to open them (which is not that weird/rare scenario as it sounds), then `package` won't scan (all) my source/target folders, @khmarbaise – xerx593 Jan 12 '22 at 11:02
  • and if you have an artifact which is named "common" (which de facto implies, that "many depend on that"), then *"better" `install` it*. ;) – xerx593 Jan 12 '22 at 11:11
  • If you don't have an IDE you should start to use one. That makes no sense working without an IDE...nor old IDE's upgrade them... does not make sense either... – khmarbaise Jan 12 '22 at 11:15

1 Answers1

0

It is generated a jar file to each module, then you should build all modules again.