redis / redis-om-spring

Spring Data Redis extensions for better search, documents models, and more
MIT License
600 stars 93 forks source link

Annotation Processor does not appear to be invoked #173

Closed abiri-1mrobotics closed 1 year ago

abiri-1mrobotics commented 1 year ago

We are using the library and everything seems to be working expect the meta model generation.

I suspect it's due to this:

@SupportedAnnotationTypes("com.redis.om.spring.annotations.Document")
@SupportedSourceVersion(SourceVersion.RELEASE_11)
@AutoService(Processor.class)
public final class MetamodelGenerator extends AbstractProcessor {

Is the generator limited to Java 11 projects?

We're using Gradle and Kotlin with Java 17, but while trying to diagnose the problem we created one Java Pojo to test. As far as we can tell the meta model generator either isn't running or is not picking up the Pojo class.

# Person.java
import com.redis.om.spring.annotations.Document;
import com.redis.om.spring.annotations.Searchable;
import org.springframework.data.annotation.Id;

@Document
public class Person {
    @Id
    private String id;
    @Searchable
    private String name;

    ... // Getters and setters (No Lombok in project)
}
# build.gradle.kts

plugins {
    kotlin("jvm")
    kotlin("kapt")
}

dependencies {
    annotationProcessor("com.redis.om:redis-om-spring:0.6.4")
    kapt("com.redis.om:redis-om-spring:0.6.4")
    implementation("com.redis.om:redis-om-spring:0.6.4")
}

We are not seeing anything in the build/.../generated folder and cannot resolve Person$ in the project.

Are we doing something wrong or is it simply that Java 17 is not supported yet?

bsbodden commented 1 year ago

Can you post your Gradle build?

bsbodden commented 1 year ago

And make sure that you include the dependency as:

ext {
  redisOmVersion = '0.8.0-SNAPSHOT'
}

dependencies {
    implementation: "com.redis.om:redis-om-spring:$redisOmVersion"
    }
}
abiri-1mrobotics commented 1 year ago

Hi - I have no idea why but it suddenly started working!

Closing. Sorry for wasting time... :-)

rjdkolb commented 1 year ago

@abiri-1mrobotics ,are you using other annotation processors as well? I had an issue with Maven and Java which I have a solution for. I was using Lombok, MapStruct and QueryDSL as well. I see you said you were not using Lombok, but just checking.