At work we have an entity library which is used by several clients for the library (several servlets, a desktop application, etc.). The entity library consists of JPA-Annotated classes and most prominently a persistence.xml.
All projects are configured using maven.
Where should a persistence.xml file be put? It needs to be located inside the jar file of that entity library and I'm not sure how to configure this using maven.
(We are just splitting up a project into several smaller projects)
'''UPDATE''' To be clear about this, there is one Maven-Project A containing the persistence.xml and another one (B) which depends on that Project. I've places persistence.xml in src/main/resources/META-INF/persistence.xml in A, when trying to use an EntityManager inside A, no problem, insidie B: nothing works.
EclipseLink gives the following Warning:
[EL Warning]: The collection of metamodel types is empty. Model classes may not have been found during entity search for Java SE and some Java EE container managed persistence units. Please verify that your entity classes are referenced in persistence.xml using either <class> elements or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element
I suspect the persistence.xml is not found, but it is present in the target jar.
question from:
https://stackoverflow.com/questions/10871109/where-to-put-persistence-xml-in-library-jar-using-maven 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…