How do I configure JPA with the Eclipse plugin?

I have been trying to find a way to configure JPA platform/implementation for Eclipse but could not find anything relevant. Did I miss anything or there is just no such support?

If I have to roll my own, mainly generating two files .settings/org.eclipse.jpt.core.prefs and .settings/org.eclipse.wst.common.project.facet.core.prefs.xml, are there examples out there that I can follow?

Thanks!!

The Gradle Eclipse plugin doesn’t have any particular support for JPA. Are you already applying the ‘eclipse-wtp’ plugin? If you need to create files other than those created by that plugin, you’ll need to write some tasks from scratch, perhaps leveraging Groovy’s MarkupBuilder to generate the XML.

Thank you for the confirmation and the XML tip. I ended up adding this block to my eclipse.wtp for now:

eclipse {
 wtp {
   facet {
   facet name:'jpt.jpa', version:'2.0'
  }
      File prefsFile = file('.settings/org.eclipse.jpt.core.prefs')
  prefsFile.parentFile.mkdirs()
    prefsFile.write('eclipse.preferences.version=1\n')
  prefsFile.append('org.eclipse.jpt.core.platform=eclipselink2_4')
    def writer = new StringWriter()
  def xml = new MarkupBuilder(writer)
  xml.root() {
   facet(id:'jpt.jpa') {
    node(name:'libprov') {
     attribute(name:'provider-id', value:'jpa-no-op-library-provider')
    }
   }
  }
  prefsFile = file('.settings/org.eclipse.wst.common.project.facet.core.prefs.xml')
  prefsFile.write(writer.toString());
 }
}

Maybe someday I will learn to write a proper plug-in for JPA :slight_smile: