I have two maven web application, let's say ProjectA and ProjectB which are packed as WAR files. Both applications are using third maven application ProjectC which contains some shared classes. I added ProjectC as dependency in ProjectA and ProjectB.
ProjectA and ProjectB are running in Eclipse using maven jetty plugin, but in production it is deployed as WAR files to the Tomcat web server.
This approach used to work fine until the moment I started to share some hibernate entities. Due to the problem I described in this question, jar-file from persistence.xml is not found in eclipse, it's not possible to link persistence.xml with entities in ProjectC.jar so I have to find some alternative solution.
I thought that it would work if I could compile ProjectC classes when ProjectA and ProjectB are compiled, so the structure looks like:
projectA
-WEB-INF
-classes
-project-a.classes
-project-c.classes
projectB
-WEB-INF
-classes
-project-b.classes
-project-c.classes
rather then:
projectA
-WEB-INF
-classes
-project-a.classes
-lib
-project-c.jar
projectB
-WEB-INF
-classes
-project-b.classes
-lib
-project-c.jar
I don't know if this is possible to do with maven multimodule approach, but some other ideas which will solve the problem are also welcome.
Thanks,