intellij idea - Gradle build fails on Lombok annotated classes -
i have jhipster project in have added dependency lombok in build.gradle:
compile group: 'org.projectlombok', name: 'lombok', version: lombok_version
and have lombok plugin stalled intellij. i've turned on annotation processing in intellij, can build without errors intellij ide, when try build command line build errors. seems gradle not processing annotations , can't find getter/setter , log declarations. project runs without kind of errors.
command line:
./gradlew build
errors :
/users/.../source/v4.0/src/main/java/com/.../service/myservice.java:145: error: cannot find symbol log.info("security context: " + securityutils.getcurrentuserlogin()); ^ symbol: variable log location: class myservice
error:
/users/.../source/v4.0/src/main/java/com/.../service/myservice.java:105: error: cannot find symbol myclass.setdescription(description); ^ symbol: method setdescription(string) location: variable myclass of type myclass
service class:
import lombok.extern.slf4j.slf4j; import org.springframework.stereotype.service; @service @slf4j public class myservice { public void somemethod(){ log.debug("security context: " + securityutils.getcurrentuserlogin()); myclass myclass = new myclass(); myclass.setdescription(description); } }
entity class:
import lombok.getter; import lombok.noargsconstructor; import lombok.setter; import javax.persistence.entity; import javax.persistence.table; @entity @table(name="t_juror_file_update") @getter @setter @noargsconstructor public class myclass { private string description; }
i've been trying figure out hours, totally stuck. appreciated.
you need specify lombok
annotation processor. this, need add following build.gradle
in jhipster
project.
apply plugin: 'net.ltgt.apt' dependencies { provided "org.projectlombok:lombok:$lombokversion" apt "org.projectlombok:lombok:$lombokversion" /** ... */ }
jhipster
uses net.ltgt.gradle:gradle-apt-plugin
annotation processing.
for intellij
setup, enable annotation processing
should checked.
more info: project lombok - android instructions
Comments
Post a Comment