Generating JPA2 Metamodel from a Gradle build script

前端 未结 7 1405
长情又很酷
长情又很酷 2020-11-30 02:24

I\'m trying to set up a Gradle build script for a new project. That project will use JPA 2 along with Querydsl.

On the following page of Querydsl\'s reference docume

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-30 03:17

    With Gradle 1.3 and newer (older not tested) you can use Querydsl APT like this:

    configurations {
      javacApt
    }
    dependencies {
      javacApt 'com.mysema.querydsl:querydsl-apt:3.3.0'
    }
    compileJava {
      options.compilerArgs <<
        '-processorpath' << (configurations.compile + configurations.javacApt).asPath <<
        '-processor' << 'com.mysema.query.apt.jpa.JPAAnnotationProcessor'
    }
    

    These compiler args are passed directly to javac.

    To use with groovy compiler replace compileJava with compileGroovy.

提交回复
热议问题