title: JPA: Unable to resolve explicitly named mapping-file in JavaSE
body: <p>I am making a small program to migrate data from another system we don't own, to a custom one we are making inside our company. I am using IntellJ with Maven, but the error seems to come from the target folder after building as It seems unable to find the folder, and when I browse inside it, Intellij gives me an error.</p>
  
  <p>persistence.xml  in src/ I cut a bit so I don't bloat this post with a big image.
  <a href="https://i.stack.imgur.com/Wgsww.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wgsww.png" alt="Persistence.xml in src/"></a></p>
  
  <p>Here is a small screenshot of the output after doing compiling as you can see the files are placed where they belong.</p>
  
  <p><a href="https://i.stack.imgur.com/7nu3O.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7nu3O.png" alt="Output after compile"></a></p>
  
  <p>And when I check the persistence.xml inside the folder, here Intellij says that the files cannot be resolved.</p>
  
  <p><a href="https://i.stack.imgur.com/ORXk8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ORXk8.png" alt="target folder persistence.xml"></a></p>
  
  <p>This is not the original location of those xml files, as they were generated by the IDE inside the package edu.apde.f5.model.$project, at first they were not included in the build so I moved them inside the resources/META-INF/etc path, and they appeared, but It is still giving the same error. Also tried with the path META-INF/$project-mapping and still nothing.</p>
  
  <p>Error received in output, this is the error I get after trying to run the project, this occurs when I call Entity Manager and I call the "MsSchoolPersistenceUnit"</p>
  
  <pre><code>java.lang.reflect.InvocationTargetException
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
  at java.lang.Thread.run(Thread.java:748)
  Caused by: org.hibernate.boot.MappingException: Unable to resolve explicitly named mapping-file : src/main/resources/META-INF/msschool-mapping/ScReligion.xml : origin(src/main/resources/META-INF/msschool-mapping/ScReligion.xml)
  at org.hibernate.boot.model.process.internal.ScanningCoordinator.applyScanResultsToManagedResources(ScanningCoordinator.java:214)
  at org.hibernate.boot.model.process.internal.ScanningCoordinator.coordinateScan(ScanningCoordinator.java:82)
  at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.prepare(MetadataBuildingProcess.java:99)
  at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.&lt;init&gt;(EntityManagerFactoryBuilderImpl.java:232)
  at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.&lt;init&gt;(EntityManagerFactoryBuilderImpl.java:174)
  at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:76)
  at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:171)
  at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:119)
  at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:61)
  at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:50)
  at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
  at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
  at edu.apde.f5.util.EntityManagerUtil.getEntityManager(EntityManagerUtil.java:12)
  at edu.apde.f5.data.msschool.AlumnoRepository.fetchAll(AlumnoRepository.java:17)
  at edu.apde.f5.main.Main.main(Main.java:10)
  ... 6 more
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  </code></pre>