a) If I put persistence.xhtml in src/main/java/META-INF/ Gradle won't include it in generated jar file, as it is not a java file.
b) If I put it in src/main/resources/META-INF/ Gradle will include it in generated jar file but Eclipse will complain of "No persistence.xml file found in project" even if I include src/main/resources in source build path.
How can I solve this?
resources/META-IN/ is the correct location. I don't use Eclipse, so I can't help you, but I'm sure it's some kind of configuration issue.
These days I use Spring to bootstrap my JPA, and then I don't even need a persistence.xml file, which is good since I like code and hate configuration files.