Jenkins build maven module

Hello, I’m a new and impractical user of jenkins and maven, I have a task to do but I can’t complete it, I have to run a test project in java + maven, the project is made up of 3 modules, dependent on each other them and are located in a repository inside the organization. I have no problems running the single project, but I don’t understand how I can run the project with these 3 modules.
Can you help me or give a guide?

root Pom.xml
X ----> module 1
pom.xml
X ----> module 2
pom.xml (module reference 1)
X ----> module 3
pom.xml (reference module 1 and module 2)

Thank you.

I’m no maven expert, but I think there’s 2 options

  1. Build and install each version seperately
pipeline {
  stages {
    stage('build 1') {
      steps {
        dir('module1') {
          sh('mvn install')
        }
      }
   }
}
  1. have a multi module root pom.xml (like blueocean) and let maven figure it out.

Personally I would go with #2

Thank you.
Thank you.