Naren
Naren

Reputation: 239

Annotation processor 'org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor' not found

I am trying to implement hibernate metamodel in my spring boot application. I am getting

Annotation processor 'org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor' not found

above error, while building applications.

My Gradle configuration and detailed error given below

buildscript {
    ext {
        springBootVersion = '2.2.6.RELEASE'
    }
    repositories {
        mavenCentral()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        classpath('se.transmode.gradle:gradle-docker:1.2')
        classpath("gradle.plugin.at.comm_unity.gradle.plugins:jpamodelgen-plugin:1.1.4")
    }
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: "jacoco"
apply from: 'docker.gradle'
apply plugin: "at.comm_unity.gradle.plugins.jpamodelgen"


sourceCompatibility = 1.8

bootJar {
    launchScript()
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-mail'
    implementation 'org.springframework.boot:spring-boot-starter-quartz'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'io.jsonwebtoken:jjwt-api:0.10.5'
    implementation 'org.flywaydb:flyway-core'
    compileOnly 'org.projectlombok:lombok'
    implementation 'org.springframework.boot:spring-boot-devtools'
    runtimeOnly 'com.h2database:h2'
    runtimeOnly 'mysql:mysql-connector-java'
    runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.10.5'
    runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.10.5'
    annotationProcessor 'org.projectlombok:lombok'
    annotationProcessor('org.hibernate:hibernate-jpamodelgen:5.4.14.Final')
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
    testImplementation 'org.springframework.security:spring-security-test'
}

test.reports.junitXml.setDestination(file("${buildDir}/test-results"))

jacocoTestReport {
    reports {
        html.destination file("${buildDir}/jacocoHtml")
    }
}

jpaModelgen {
    library = "org.hibernate:hibernate-jpamodelgen"
    jpaModelgenSourcesDir="src/jpaModelgen/java"
}


sourceSets {
    main {
        java {
            srcDirs += "src/jpaModelgen/java"
        }
    }
}

While running the application with ./gradlew build --info i am getting below error

enter image description here

Im using spring-boot 2.2.6, Is there any version compatibility available for hibernate-jpamodelgen.

Upvotes: 2

Views: 6606

Answers (1)

kinnakatsdop
kinnakatsdop

Reputation: 1

You don't need to use any plugin to generate JPA metamodel. It is enough to use the line

annotationProcessor 'org.hibernate.orm:hibernate-jpamodelgen:<6.1.1.Final now or other version>'

in build.gradle dependencies block.

Upvotes: 0

Related Questions