I have a Spring Boot (v1.4.2) Application with Spring Data JPA and Hibernate (5.0.11.Final if I'm not mistaken). I added the jpadmodelgen-plugin to generate the metamodel classes for me, because, you know, I'm lazy. Unfortunately, when I run gradle build
I get some nasty errors. The curious thing about this is that doing gradle test
(which does real unit and integration tests of the complete application) runs without an error. I can even run the app in IntelliJ and life's great. It's just that my butler Jenkins can't build it.
> gradle build
:initJpaModelgenSourcesDir
:compileJpaModelgen UP-TO-DATE
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:findMainClass
:jar
:bootRepackage
:assemble
:compileJpaModelgenJava
Mapping_.java:3: error: cannot find symbol
import com.<snip>.model.domain.auth.Member;
^
symbol: class Member
location: package com.<snip>.model.domain.auth
Mapping_.java:7: error: package javax.persistence.metamodel does not exist
import javax.persistence.metamodel.SingularAttribute;
^
Mapping_.java:8: error: package javax.persistence.metamodel does not exist
import javax.persistence.metamodel.StaticMetamodel;
^
100 errors
:compileJpaModelgenJava FAILED
FAILURE: Build failed with an exception.
The error shows that not only are my own classes not found but javax.persistence as well. Here's the build.gradle
file.
buildscript {
ext {
springBootVersion = '1.4.2.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath('gradle.plugin.at.comm_unity.gradle.plugins:jpamodelgen-plugin:1.1.2')
}
}
plugins {
id "at.comm_unity.gradle.plugins.jpamodelgen" version "1.1.2"
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'findbugs'
apply plugin: 'jacoco'
jar {
baseName = 'services'
version = '1.0.0'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
jpaModelgen {
library = "org.hibernate:hibernate-jpamodelgen:5.0.11.Final"
jpaModelgenSourcesDir = "src/generated/java"
}
findbugs {
ignoreFailures = true
reportLevel = 'low'
}
javadoc {
failOnError = false
}
dependencies {
// Spring Boot, some Apache Commons libs and JDBC Drivers.
}
sourceSets {
unitTest {
resources {
srcDir "resources"
}
}
/*generated {
java.srcDir "${buildDir}/src/generated/java"
}*/
}
compileJava.options.compilerArgs += ["-proc:none"]
Avengers Assemble! I need help, please.