How to combine 3 maven projects into single window
Answered
Hi,
I've recently shifted to IDEA and finding it hard to get simple things from Eclipse get working here.
I would like to see 3 maven projects in single window how to achieve the same ?
Thanks & Regards,
Vikram
Please sign in to leave a comment.
I got this working by following below threads
https://stackoverflow.com/questions/8774024/intellij-working-on-multiple-projects
https://stackoverflow.com/questions/30463738/eclipse-workspace-equivalent-in-intellij
but I'm not sure how to make one of the project refer to another one. In Eclipse it's quite straight forward as mentioned below
https://stackoverflow.com/questions/10553677/eclipse-how-to-give-dependency-between-projects
Check this sample project: https://github.com/jamesward/maven-multi-module-example.
Notice that it has the root pom.xml file listing sub-projects (modules):
Every module has a separate pom.xml file in the module subdirectory.
App module depends on the core module, this dependency is specified in the app's module pom.xml file:
IntelliJ IDEA correctly adds this dependency when you open/import the root pom.xml file:
Project view lists all the imported modules:
The same way you can specify as many modules as you need.
Thanks a ton Serge, this answer helped to get my project up and running.
https://stackoverflow.com/questions/44954034/intellij-idea-how-to-give-dependency-between-projects
Regards,
Vikram
Are you able to have multiple modules that depend on each other to catch changes on the fly withou using mvn clean install.
What I mean is project A and B imported and maven modules into intellij 2023.3 where
── A
├── pom.xml
├── version 1.0.0.0-SNAPSHOT
── B
├── pom.xml
├── version 2.0.0.0-SNAPSHOT
├── dependency to A:1.0.0.0-SNAPSHOT
If you make a change on a java class @A does project B catch that change. I allways have to execute mvn clean install to get it from me local m2 repository.
my expectation is:
> Are you able to have multiple modules that depend on each other to catch changes on the fly withou using mvn clean install.
Sure, if you use module dependencies as outlined in my comment above, the IDE will resolve the dependencies via sources and the code will be updated on the fly.
I'm not able to make it work not sure why?!!!
I have a more complex scenario
── A
├── pom.xml
├── version 1.0.0.0-SNAPSHOT
├── module A1
├── version 1.0.0.0-SNAPSHOT
|── module A2
├── version 1.0.0.0-SNAPSHOT
── B
├── pom.xml
├── version 2.0.0.0-SNAPSHOT
├── module B1
├── dependency to A2:1.0.0.0-SNAPSHOT
I did what you suggested, a parent pom.xml file
── multi
├── pom.xml
├── version 1.0.0.0-SNAPSHOT
|── module A
|── module B
It was properly loaded since the maven view was updated with a multi maven project parent of A and B.
I tested this by changing an an xml file on A2 that I reference via classpath on B1 when I change the xml file B1 loads the older version I need to run mvn clean install so the updated xml can be loaded :-( not sure what else to do and this looks like a normal utilization of the IDE :-(
If it doesn't work for you, please report an issue at https://youtrack.jetbrains.com/newIssue?project=IDEA and attach a sample project with the parent pom with the exact steps to reproduce it.
I will do thank you for your help