I'm trying to use Intellij 2017 Ultimate to build/run a Spring Boot application that uses MapStruct. It is a Gradle project. My issue is that IntelliJ does not seem to run the MapStruct Annotation Processor. I realize that I can configure IntelliJ to delegate to the Gradle build process (see this), but I am hoping to simply configure IntelliJ to use APT to generate the necessary classes itself.
I have enabled APT for my project, but my classes are still not generated.
build.gradle (applicable snippets):
ext {
mapstructVersion = '1.2.0.Final'
}
plugins {
id 'net.ltgt.apt' version '0.15'
}
dependencies {
// MapStruct support
implementation group: 'org.mapstruct', name: 'mapstruct-jdk8', version: mapstructVersion
annotationProcessor group: 'org.mapstruct', name: 'mapstruct-processor', version: mapstructVersion
}
IntelliJ configuration:
Yet, when I do a ./gradle clean
followed by a Build->Rebuild Project, my out/production/classes/generated folder is empty.
Is there something additional that I need to do to enable APT on this project? Should IntelliJ automatically detect the mapstruct annotation processor in the classpath?
Finally it is working fine 👍 with Intellji 2018.1 CE. we don't need any apt plugins.
Here is updated gradle file
plugins {
id 'java'
}
repositories {
mavenCentral()
mavenLocal()
}
sourceCompatibility = JavaVersion.VERSION_1_8
dependencies {
compile group: 'org.mapstruct', name: 'mapstruct-jdk8', version: '1.2.0.Final'
compileOnly 'org.mapstruct:mapstruct-processor:1.2.0.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.2.0.Final'
compileOnly ("org.projectlombok:lombok")
testCompile 'junit:junit:4.12'
}
Please make sure following things are configured properly
Enable Annotations Processors( Preference->Build Execute Deployment ->Compiler->Annotations Processors )
MapStruct plugin
Lombok plugin