Mapstruct Annotation Processor does not seem to work in Intellij with Gradle project

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 {
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

  1. Enable Annotations Processors( Preference->Build Execute Deployment ->Compiler->Annotations Processors )

  2. MapStruct plugin

  3. Lombok plugin

My build.gradle:

plugins {
    id 'java'
    id 'idea'

ext {
    mapstructVersion = '1.2.0.Final'

dependencies {

    // bean mapping
    compile group: 'org.mapstruct', name: 'mapstruct-jdk8', version: mapstructVersion
    compileOnly group: 'org.mapstruct', name: 'mapstruct-processor', version: mapstructVersion
    annotationProcessor group: 'org.mapstruct', name: 'mapstruct-processor', version: mapstructVersion


Refresh and try to rebuild your project. If it doesn't work smoothly for you, proceed to the Troubleshooting section below.


If it doesn't work for you...

  1. Enable Annotation Processors manually.
    It seems to be a bug in IDEA related to annotationProcessor configuration.

    IntelliJ IDEA -> Configure Annotations Processors (click to enlarge the screenshot)

  2. Check out build output in "out/production/classes/generated" folder. If it's empty, try to rebuild your project. Make sure changes are applied by manually deleting contents of build output folders and modifying your mapper class before the rebuild.

     $ rm -rf out build .gradle
  3. Verify your Gradle build file by building and running the project outside of IntelliJ IDEA.

  4. Try to delegate build actions to Gradle. I don't use this option, because annotation processor works for me anyway.

    IntelliJ IDEA -> Delegate build/run actions to Gradle

  5. Update to IntelliJ IDEA 2018.3 or later.