1

There is a Maven project with two modules with this structure.

project
    moduleA
       pom.xml   // library 

    moduleB
       pom.xml   // SpringBoot application

    pom.xml      // parent aggregator

Module B depends on A.

When executing command mvn spring-boot:run -pl moduleB (from project folder) Maven takes compiled package moduleA.jar from local repository and fails if it is absent there.

Please, help me to find a way of forcing usage of the latest compiled moduleA version every time the moduleB application starts.

In perfect case I would like to avoid mvn install step, just inducing mvn compile (if code changed) or reusing a compiled moduleA; but it also works if somehow application could be started with the latest compiled version of all code in the multimodular project.

diziaq
  • 6,881
  • 16
  • 54
  • 96
  • Please show your pom files... Apart from that where are you starting your command (which location?) – khmarbaise Jan 27 '22 at 12:07
  • Would'nt an -am (also make) force do it if the modules are interdependent . From the sub-project mvn clean compile install -am – Ramachandran.A.G Jan 27 '22 at 14:22
  • First using `clean compile install` shows that you haven't understood the life cycle. `mvn clean install` is sufficient.. Furthermore I would suggest to build from root location (project/ directory instead) because you have a dependency to moduleA... this would mean you can just use `mvn clean package` instead... running spring boot app is just `java -jar xyz.jar` ... – khmarbaise Jan 27 '22 at 16:22

0 Answers0