How do I use EclipseLink with Gradle


(René Vangsgaard) #1

I cannot run or test the project - the persistence.xml file is not found on the classpath. It currently lives in src/main/resources/META-INF

I saw this post from the developers, which unfortunately have no conclusion and does not link to an issue tracker: http://gradle.1045684.n5.nabble.com/fixing-JPA-handling-td5480821.html


(Peter Niederwieser) #2

Try:

sourceSets.all {
  output.resourcesDir = output.classesDir
}

(René Vangsgaard) #3

Did not help.

I am using EclipseLink if it helps anything.

I get this error, even though both classes are named in persistence.xml.

Exception Description: [class application.model.PageInfo] uses a non-entity [class application.model.BusinessArea] as target entity in the relationship attribute [field businessArea].

It runs from within Eclipse - I think Eclipse is cheating by just merging all classpaths, or something.


(Peter Niederwieser) #4

That’s strange. Usually it always solves the problem.


(René Vangsgaard) #5

Thank you for the tip. I will update this thread if I find the solution.


(Awadhesh Kumar) #6

Any solution of this problem? I also got the same problem. Please help.