0

I have a project structure like:

enter image description here

However, whenever I run mvn clean test -DskipTests from the Project 1 directory, it ends up NOT including the Project 2 module in the Maven reactor even though I've listed it as a dependency in Project 1 as follows:

<dependency> <groupId>com.main.sub</groupId> <artifactId>project2-artId</artifactId> <version>1.0-SNAPSHOT</version> </dependency> 

What could be happening and why isnt the dependency being recognized?

3
  • what do you mean by "not recognized"- do you mean the module is not existent, or that you expect it to be recompiled and it isn't, or else? Commented Feb 28, 2019 at 18:23
  • @Daniele I expect it to be recompiled but it isnt. I am maybe messing up the multi module idea Commented Feb 28, 2019 at 18:29
  • 1
    well are they both modules of the same parent project? You can build the parent instead Commented Feb 28, 2019 at 18:43

1 Answer 1

1

From https://maven.apache.org/guides/mini/guide-multiple-modules.html; the reactor "Collects all the available modules to build". (modules of the project that is currently being built)

You need to: create a parent project, with packaging pom; add two modules to this project (one for Project1, one for Project2), and submodules for project1.

Then, when you build the parent project, the build order for all modules are decided by the reactor-

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.