bytedeco / gradle-javacpp

Gradle plugins to automate the build process of JavaCPP and JavaCV
Other
57 stars 20 forks source link

task javacppCompileJava fails with lombok #11

Open irnbrux opened 3 years ago

irnbrux commented 3 years ago

Hi,

gradle fails to build java code, when the gradle-javacpp plugin is added. It looks liek javacppCompileJava is not working correctly.

Example gradle.build

plugins { id 'java-library' id 'org.bytedeco.gradle-javacpp-build' version "1.5.5" }

dependencies { compileOnly 'org.projectlombok:lombok:1.18.20' annotationProcessor 'org.projectlombok:lombok:1.18.20' testCompileOnly 'org.projectlombok:lombok:1.18.20' testAnnotationProcessor 'org.projectlombok:lombok:1.18.20' }

Example java code like:

import lombok.val;

public class Bla { void example() { val something = somedatatype; } }

Error message during gradle build: example: error: incompatible types: org.nd4j.linalg.api.ndarray.INDArray cannot be converted to lombok.val val fA = A.castTo(DataType.FLOAT);

The problem goes away, when the gradle-javacpp plugin is removed from gradle.build

Thanks Brian

saudet commented 3 years ago

That sounds like an issue with custom compile tasks of Gradle, but in any case, we do not need Lombok for JavaCPP, so do not include those files in the javacppCompileJava task and everything will work fine.

irnbrux commented 3 years ago

@saudet Indeed, a quick fix is to exclude using

javacppCompileJava { exclude 'org/whatever/**' }