1

I read a lot of almost similar question, but I have different problem then others.

I have 3 projects:

  1. Project_A
  2. Project_B
  3. Project_Shared

Solution 1: Local installed jar

I want to develop Project_A independently from Project_B. But both use Project_Share, which I also want to develop - this is why I can't manually make one jar from Project_Share and install it in local Maven repository.

Solution 2: Two different parent pom

I also really don't want to change Project_A and Project_B structure - through adding for them two different maven parent pom. As far as I understand - I can add parent pom for two module: Project_A and Project_Share and then I could run Project_A using Parent project. And I can't run Project_A directly from it (this will complain about Project_Shared jar missing - am I right?

Ideal solution:

Configure maven for Project_A in such way that after I run Project_A, it will look to directory of Project_Shared, compile it, and obtain its jar, then build Project_A with this jar, and run Project_A.

Question:

Is it possible to obtain ideal solution? Or is there any better solution? Or maybe I misunderstand something?

Thanks for Your help!

jsosnowski
  • 1,560
  • 3
  • 26
  • 56
  • 1
    I don't understand the sentence: ` this is why I can't manually make one jar from Project_Share and install it in local Maven repository.`? Why not? That is exactly the solution... – khmarbaise Aug 18 '15 at 09:26
  • You are right. I can do this manually, after changing Project_Share. I thought that this can be done manually by some goal from Project_A - but it could be to sophisticated. – jsosnowski Aug 18 '15 at 10:08

1 Answers1

1

Do I get you right that Project_A and Project_B are two different projects (none of them is parent of the other) so that they should be completely independet?

You have Project_A and Project_B with their own pom.xml. Both are dependet from Project_Shared. So Project_Shared has it's own pom.xml which is referenced by the other project poms as dependencies.

Initially you call mvn install for Project_Shared. After that you can build the other projects. You do the same thing if you want to change Project_Shared and the change should be accessible for both projects.

Niklas P
  • 3,427
  • 2
  • 15
  • 19
  • Yes you're right. This solution require to remember call `mvn install` after each modification of Project_Shared, but it is not too difficult. So this will be accepted if no better answer appears. – jsosnowski Aug 18 '15 at 10:13
  • Probably the following ( **resolve workspace artifacts** ) also will help in eclipse to let the maven-plugin automatically build the *Project_Shared* within the build process of *Project_A* or *Project_B*: http://stackoverflow.com/questions/13205734/m2eclipse-plugin-what-does-resolve-workspace-artifacts-do – Niklas P Aug 18 '15 at 11:44