Search code examples
javagradlejava-native-interfacejavaclombok

Can't compile .h file in console with javac and lombok. Error: package lombok does not exist


I need to compile .h file for my native library based on JNI. After I add some lombok annotations to my project I can't compile .h file with javac. I'm using IntelliJ and grade. I'm trying to perform next command in ide console:

javac -h jni src/java/main/com/my/project/*.java

And get error:

 src/java/main/com/my/project/Appjava:3: error: package lombok does not
 exist import lombok.AccessLevel;
              ^ 
src/java/main/com/my/project/App.java:4: error: package lombok does not exist import lombok.RequiredArgsConstructor;
              ^ 
src/java/main/com/my/project/App.java:5: error: package lombok >does not exist import lombok.Value;

and many similar errors in other classes. 3, 4 and 5 lines in App class:

import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.Value;

in build gradle:

 compileOnly 'org.projectlombok:lombok:1.18.8'
annotationProcessor 'org.projectlombok:lombok:1.18.8'

Also annotation processing enabled and lombok plugin installed. I can build project in my ide but can't perform command javac. How I can fix it?


Solution

  • if you are running javac on command line then the gradle won't come into play; you will need to pass the classpath -cp <all_jars>