I have a JHipster project in which I added a dependency for Lombok in build.gradle:
compile group: 'org.projectlombok', name: 'lombok', version: lombok_version
And I have a Lombok plugin stalled for IntelliJ. I turned on annotation processing in IntelliJ, I can build without errors from the IntelliJ IDE, but when I try to build from the command line, I get build errors. It seems that Gradle does not process annotations and cannot find getter / setter and log declarations. The project also works without any 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
Mistake:
/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
Class of service:
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 tried to figure this out for hours, but was completely stuck. Any help would be appreciated.
intellij-idea lombok gradle jhipster
Jose Gulisano
source share