diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f0a0e071c..7c9cc4884 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,6 +32,10 @@ jobs: key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }} restore-keys: ${{ runner.os }}-gradlew- + - name: Code Style Check + run: | + ./gradlew spotlessCheck -S + - name: Build run: | ./gradlew build aggregateTestReport -S diff --git a/.spotless/roms-style.xml b/.spotless/roms-style.xml new file mode 100644 index 000000000..996647277 --- /dev/null +++ b/.spotless/roms-style.xml @@ -0,0 +1,380 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 305f30426..86954d4cc 100644 --- a/README.md +++ b/README.md @@ -632,22 +632,22 @@ detail. [Open an issue on GitHub](https://github.com/redis-om/redis-om-spring/is ### Code Style -This project uses the Spotless Maven plugin with Eclipse formatter to enforce a consistent code style. Before submitting a pull request, please make sure your code follows our formatting guidelines by running: +This project uses the Spotless Gradle plugin with Eclipse formatter to enforce a consistent code style. Before submitting a pull request, please make sure your code follows our formatting guidelines by running: ```bash -mvn spotless:apply +./gradlew spotlessApply ``` This will automatically reformat your code to match the project's style. You can also check if your code meets the formatting requirements without changing it: ```bash -mvn spotless:check +./gradlew spotlessCheck ``` The main formatting rules include: - 2-space indentation (not 4) - KNR brace style (braces at end of line) -- Maximum line length of 100 characters +- Maximum line length of 120 characters - Consistent import ordering (java, javax, org, com, other imports) ## 🧑‍🤝‍🧑 Sibling Projects diff --git a/build.gradle b/build.gradle index 47ec97fd5..0bcd6f86c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,26 +1,33 @@ plugins { - id 'org.springframework.boot' version "${springBootVersion}" apply false + id 'org.springframework.boot' version "${springBootVersion}" apply false + id 'com.diffplug.spotless' version '6.25.0' + id 'java' // Add java plugin to root project } ext['jedis.version'] = "${jedisVersion}" allprojects { - version = project.version - group = project.group - description = project.description - repositories { - mavenLocal() - mavenCentral() - } + version = project.version + group = project.group + description = project.description + repositories { + mavenLocal() + mavenCentral() + } } +// Apply the Spotless configuration +apply from: "spotless.gradle" + subprojects { - apply from: "$rootDir/gradle/build-conventions.gradle" + apply from: "$rootDir/gradle/build-conventions.gradle" } tasks.register('aggregateTestReport', TestReport) { - destinationDirectory = layout.buildDirectory.dir("reports/tests/aggregate") - testResults.setFrom( - subprojects.collect { it.tasks.withType(Test) } - ) + destinationDirectory = layout.buildDirectory.dir("reports/tests/aggregate") + testResults.setFrom( + subprojects.collect { + it.tasks.withType(Test) + } + ) } diff --git a/gradle/build-conventions.gradle b/gradle/build-conventions.gradle index 70dc0bc55..a2e2d8602 100644 --- a/gradle/build-conventions.gradle +++ b/gradle/build-conventions.gradle @@ -3,89 +3,89 @@ apply plugin: 'io.spring.dependency-management' apply plugin: 'maven-publish' java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } - withJavadocJar() - withSourcesJar() + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } + withJavadocJar() + withSourcesJar() } test { - useJUnitPlatform() + useJUnitPlatform() } dependencyManagement { - imports { - mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}" - } + imports { + mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}" + } } dependencies { - compileOnly "org.projectlombok:lombok" - annotationProcessor "org.projectlombok:lombok" - testImplementation "org.projectlombok:lombok" - testAnnotationProcessor "org.projectlombok:lombok" - testImplementation 'org.junit.jupiter:junit-jupiter-api' - testImplementation 'org.junit.jupiter:junit-jupiter-params' - testImplementation 'org.junit.jupiter:junit-jupiter-engine' - testImplementation 'org.junit.platform:junit-platform-launcher' - testImplementation 'org.springframework.boot:spring-boot-starter-test' - testImplementation 'org.testcontainers:junit-jupiter' - testImplementation "com.redis:testcontainers-redis:${testcontainersRedisVersion}" + compileOnly "org.projectlombok:lombok" + annotationProcessor "org.projectlombok:lombok" + testImplementation "org.projectlombok:lombok" + testAnnotationProcessor "org.projectlombok:lombok" + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-params' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' + testImplementation 'org.junit.platform:junit-platform-launcher' + testImplementation 'org.springframework.boot:spring-boot-starter-test' + testImplementation 'org.testcontainers:junit-jupiter' + testImplementation "com.redis:testcontainers-redis:${testcontainersRedisVersion}" } publishing { - publications { - mavenJava(MavenPublication) { - from components.java - groupId = project.group - artifactId = project.name - version = project.version - description = project.description + publications { + mavenJava(MavenPublication) { + from components.java + groupId = project.group + artifactId = project.name + version = project.version + description = project.description - versionMapping { - usage('java-api') { - fromResolutionOf('runtimeClasspath') - } - usage('java-runtime') { - fromResolutionResult() - } - } + versionMapping { + usage('java-api') { + fromResolutionOf('runtimeClasspath') + } + usage('java-runtime') { + fromResolutionResult() + } + } - pom { - packaging = 'jar' - name = project.name - description = project.description - url = "https://github.com/redis/redis-om-spring" - inceptionYear = '2021' + pom { + packaging = 'jar' + name = project.name + description = project.description + url = "https://github.com/redis/redis-om-spring" + inceptionYear = '2021' - licenses { - license { - name = "MIT License" - url = "https://opensource.org/licenses/MIT" - } - } + licenses { + license { + name = "MIT License" + url = "https://opensource.org/licenses/MIT" + } + } - developers { - developer { - id = "bsbodden" - name = "Brian Sam-Bodden" - email = "bsb at redis.com" - } - } + developers { + developer { + id = "bsbodden" + name = "Brian Sam-Bodden" + email = "bsb at redis.com" + } + } - scm { - connection = "scm:git:git://github.com/redis/redis-om-spring.git" - developerConnection = "scm:git:ssh://github.com/redis/redis-om-spring.git" - url = "https://github.com/redis/redis-om-spring" - } - } - } - } + scm { + connection = "scm:git:git://github.com/redis/redis-om-spring.git" + developerConnection = "scm:git:ssh://github.com/redis/redis-om-spring.git" + url = "https://github.com/redis/redis-om-spring" + } + } + } + } - repositories { - maven { - url = rootProject.layout.buildDirectory.dir('staging-deploy') - } - } + repositories { + maven { + url = rootProject.layout.buildDirectory.dir('staging-deploy') + } + } } diff --git a/redis-om-spring-ai/build.gradle b/redis-om-spring-ai/build.gradle index d0bf810c5..a84c3b9c7 100644 --- a/redis-om-spring-ai/build.gradle +++ b/redis-om-spring-ai/build.gradle @@ -1,40 +1,39 @@ description = 'Redis OM Spring AI' dependencies { - implementation project(':redis-om-spring') + implementation project(':redis-om-spring') - implementation "org.springframework.ai:spring-ai-openai:${springAiVersion}" - compileOnly "jakarta.websocket:jakarta.websocket-api" - compileOnly "jakarta.websocket:jakarta.websocket-client-api" - implementation "org.springframework.ai:spring-ai-ollama:${springAiVersion}" - implementation "org.springframework.ai:spring-ai-azure-openai:${springAiVersion}" - implementation "org.springframework.ai:spring-ai-vertex-ai-embedding:${springAiVersion}" - implementation "org.springframework.ai:spring-ai-bedrock:${springAiVersion}" - implementation "org.springframework.ai:spring-ai-transformers:${springAiVersion}" - compileOnly "org.springframework.ai:spring-ai-mistral-ai:${springAiVersion}" - compileOnly "org.springframework.ai:spring-ai-minimax:${springAiVersion}" - compileOnly "org.springframework.ai:spring-ai-zhipuai:${springAiVersion}" + implementation "org.springframework.ai:spring-ai-openai:${springAiVersion}" + compileOnly "jakarta.websocket:jakarta.websocket-api" + compileOnly "jakarta.websocket:jakarta.websocket-client-api" + implementation "org.springframework.ai:spring-ai-ollama:${springAiVersion}" + implementation "org.springframework.ai:spring-ai-azure-openai:${springAiVersion}" + implementation "org.springframework.ai:spring-ai-vertex-ai-embedding:${springAiVersion}" + implementation "org.springframework.ai:spring-ai-bedrock:${springAiVersion}" + implementation "org.springframework.ai:spring-ai-transformers:${springAiVersion}" + compileOnly "org.springframework.ai:spring-ai-mistral-ai:${springAiVersion}" + compileOnly "org.springframework.ai:spring-ai-minimax:${springAiVersion}" + compileOnly "org.springframework.ai:spring-ai-zhipuai:${springAiVersion}" - compileOnly "com.google.auto.service:auto-service:${autoServiceVersion}" + compileOnly "com.google.auto.service:auto-service:${autoServiceVersion}" - // DJL Dependencies - implementation "ai.djl.spring:djl-spring-boot-starter-autoconfigure:${djlStarterVersion}" - implementation "ai.djl.spring:djl-spring-boot-starter-pytorch-auto:${djlStarterVersion}" - implementation "ai.djl.huggingface:tokenizers:${djlVersion}" + // DJL Dependencies + implementation "ai.djl.spring:djl-spring-boot-starter-autoconfigure:${djlStarterVersion}" + implementation "ai.djl.spring:djl-spring-boot-starter-pytorch-auto:${djlStarterVersion}" + implementation "ai.djl.huggingface:tokenizers:${djlVersion}" - testImplementation "org.mockito:mockito-core" - testImplementation "com.karuslabs:elementary:${elementaryVersion}" - - testImplementation "org.springframework.ai:spring-ai-openai:${springAiVersion}" - testImplementation "jakarta.websocket:jakarta.websocket-api" - testImplementation "jakarta.websocket:jakarta.websocket-client-api" - testImplementation "org.springframework.ai:spring-ai-ollama:${springAiVersion}" - testImplementation "org.springframework.ai:spring-ai-azure-openai:${springAiVersion}" - testImplementation "org.springframework.ai:spring-ai-vertex-ai-embedding:${springAiVersion}" - testImplementation "org.springframework.ai:spring-ai-bedrock:${springAiVersion}" - testImplementation "org.springframework.ai:spring-ai-transformers:${springAiVersion}" - testImplementation "org.springframework.ai:spring-ai-mistral-ai:${springAiVersion}" - testImplementation "org.springframework.ai:spring-ai-minimax:${springAiVersion}" - testImplementation "org.springframework.ai:spring-ai-zhipuai:${springAiVersion}" + testImplementation "org.mockito:mockito-core" + testImplementation "com.karuslabs:elementary:${elementaryVersion}" + testImplementation "org.springframework.ai:spring-ai-openai:${springAiVersion}" + testImplementation "jakarta.websocket:jakarta.websocket-api" + testImplementation "jakarta.websocket:jakarta.websocket-client-api" + testImplementation "org.springframework.ai:spring-ai-ollama:${springAiVersion}" + testImplementation "org.springframework.ai:spring-ai-azure-openai:${springAiVersion}" + testImplementation "org.springframework.ai:spring-ai-vertex-ai-embedding:${springAiVersion}" + testImplementation "org.springframework.ai:spring-ai-bedrock:${springAiVersion}" + testImplementation "org.springframework.ai:spring-ai-transformers:${springAiVersion}" + testImplementation "org.springframework.ai:spring-ai-mistral-ai:${springAiVersion}" + testImplementation "org.springframework.ai:spring-ai-minimax:${springAiVersion}" + testImplementation "org.springframework.ai:spring-ai-zhipuai:${springAiVersion}" } diff --git a/redis-om-spring-ai/src/main/java/com/redis/om/spring/AIRedisConfiguration.java b/redis-om-spring-ai/src/main/java/com/redis/om/spring/AIRedisConfiguration.java index ab2e91dad..aa1ab36dc 100644 --- a/redis-om-spring-ai/src/main/java/com/redis/om/spring/AIRedisConfiguration.java +++ b/redis-om-spring-ai/src/main/java/com/redis/om/spring/AIRedisConfiguration.java @@ -18,7 +18,6 @@ import org.springframework.web.client.ResponseErrorHandler; import org.springframework.web.client.RestClient; import org.springframework.web.reactive.function.client.WebClient; -import io.micrometer.observation.ObservationRegistry; import com.redis.om.spring.vectorize.DefaultEmbedder; import com.redis.om.spring.vectorize.Embedder; @@ -41,6 +40,7 @@ import ai.djl.repository.zoo.ZooModel; import ai.djl.translate.Pipeline; import ai.djl.translate.Translator; +import io.micrometer.observation.ObservationRegistry; @Configuration @EnableConfigurationProperties( @@ -63,61 +63,52 @@ public class AIRedisConfiguration { // private String password; // //// @Bean -//// @Primary -//// public JedisConnectionFactory redisConnectionFactory() { -//// RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration(); -//// redisStandaloneConfiguration.setHostName(host); -//// redisStandaloneConfiguration.setPort(port); -//// redisStandaloneConfiguration.setUsername(username); -//// redisStandaloneConfiguration.setPassword(password); -//// JedisConnectionFactory jediConnectionFactory = new JedisConnectionFactory(redisStandaloneConfiguration); -//// jediConnectionFactory.setConvertPipelineAndTxResults(false); -//// return jediConnectionFactory; -//// } -//// -//// @Bean -//// public RedisTemplate redisTemplate() { -//// -//// RedisTemplate template = new RedisTemplate<>(); -//// template.setConnectionFactory(redisConnectionFactory()); -//// return template; -//// } + //// @Primary + //// public JedisConnectionFactory redisConnectionFactory() { + //// RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration(); + //// redisStandaloneConfiguration.setHostName(host); + //// redisStandaloneConfiguration.setPort(port); + //// redisStandaloneConfiguration.setUsername(username); + //// redisStandaloneConfiguration.setPassword(password); + //// JedisConnectionFactory jediConnectionFactory = new JedisConnectionFactory(redisStandaloneConfiguration); + //// jediConnectionFactory.setConvertPipelineAndTxResults(false); + //// return jediConnectionFactory; + //// } + //// + //// @Bean + //// public RedisTemplate redisTemplate() { + //// + //// RedisTemplate template = new RedisTemplate<>(); + //// template.setConnectionFactory(redisConnectionFactory()); + //// return template; + //// } @Bean public RestClient.Builder restClientBuilder() { return RestClient.builder(); } - + @Bean public WebClient.Builder webClientBuilder() { return WebClient.builder(); } - + @Bean public ResponseErrorHandler defaultResponseErrorHandler() { return new DefaultResponseErrorHandler(); } - + @Bean public ObservationRegistry observationRegistry() { return ObservationRegistry.create(); } @Bean - public EmbeddingModelFactory embeddingModelFactory( - AIRedisOMProperties properties, - SpringAiProperties springAiProperties, - RestClient.Builder restClientBuilder, - WebClient.Builder webClientBuilder, - ResponseErrorHandler responseErrorHandler, - ObservationRegistry observationRegistry) { - return new EmbeddingModelFactory( - properties, - springAiProperties, - restClientBuilder, - webClientBuilder, - responseErrorHandler, - observationRegistry); + public EmbeddingModelFactory embeddingModelFactory(AIRedisOMProperties properties, + SpringAiProperties springAiProperties, RestClient.Builder restClientBuilder, WebClient.Builder webClientBuilder, + ResponseErrorHandler responseErrorHandler, ObservationRegistry observationRegistry) { + return new EmbeddingModelFactory(properties, springAiProperties, restClientBuilder, webClientBuilder, + responseErrorHandler, observationRegistry); } @Bean( diff --git a/redis-om-spring-ai/src/main/java/com/redis/om/spring/vectorize/EmbeddingModelFactory.java b/redis-om-spring-ai/src/main/java/com/redis/om/spring/vectorize/EmbeddingModelFactory.java index 486da53e5..8a115e499 100644 --- a/redis-om-spring-ai/src/main/java/com/redis/om/spring/vectorize/EmbeddingModelFactory.java +++ b/redis-om-spring-ai/src/main/java/com/redis/om/spring/vectorize/EmbeddingModelFactory.java @@ -30,7 +30,6 @@ import org.springframework.web.client.ResponseErrorHandler; import org.springframework.web.client.RestClient; import org.springframework.web.reactive.function.client.WebClient; -import io.micrometer.observation.ObservationRegistry; import com.azure.ai.openai.OpenAIClient; import com.azure.ai.openai.OpenAIClientBuilder; @@ -39,6 +38,7 @@ import com.redis.om.spring.AIRedisOMProperties; import com.redis.om.spring.annotations.Vectorize; +import io.micrometer.observation.ObservationRegistry; import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; import software.amazon.awssdk.auth.credentials.AwsCredentials; import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; @@ -51,13 +51,9 @@ public class EmbeddingModelFactory { private final ResponseErrorHandler responseErrorHandler; private final ObservationRegistry observationRegistry; - public EmbeddingModelFactory( - AIRedisOMProperties properties, - SpringAiProperties springAiProperties, - RestClient.Builder restClientBuilder, - WebClient.Builder webClientBuilder, - ResponseErrorHandler responseErrorHandler, - ObservationRegistry observationRegistry) { + public EmbeddingModelFactory(AIRedisOMProperties properties, SpringAiProperties springAiProperties, + RestClient.Builder restClientBuilder, WebClient.Builder webClientBuilder, + ResponseErrorHandler responseErrorHandler, ObservationRegistry observationRegistry) { this.properties = properties; this.springAiProperties = springAiProperties; this.restClientBuilder = restClientBuilder; @@ -191,12 +187,8 @@ public VertexAiTextEmbeddingModel createVertexAiTextEmbeddingModel(String model) } public OllamaEmbeddingModel createOllamaEmbeddingModel(String model) { - OllamaApi api = OllamaApi.builder() - .baseUrl(properties.getOllama().getBaseUrl()) - .restClientBuilder(restClientBuilder) - .webClientBuilder(webClientBuilder) - .responseErrorHandler(responseErrorHandler) - .build(); + OllamaApi api = OllamaApi.builder().baseUrl(properties.getOllama().getBaseUrl()).restClientBuilder( + restClientBuilder).webClientBuilder(webClientBuilder).responseErrorHandler(responseErrorHandler).build(); OllamaOptions options = OllamaOptions.builder().model(model).truncate(false).build(); diff --git a/redis-om-spring/build.gradle b/redis-om-spring/build.gradle index 112b07fbb..db58f3bfd 100644 --- a/redis-om-spring/build.gradle +++ b/redis-om-spring/build.gradle @@ -1,23 +1,22 @@ description = 'Redis OM Spring' dependencies { - api "org.springframework.boot:spring-boot-autoconfigure" - api "org.springframework.data:spring-data-redis:${sdrVersion}" - api "org.springframework:spring-aop" - api "org.springframework:spring-context-support" - api "org.aspectj:aspectjweaver" - api "org.hibernate.validator:hibernate-validator" - api "jakarta.persistence:jakarta.persistence-api" - api "com.fasterxml.jackson.core:jackson-databind" - api "redis.clients:jedis" - api "com.azure:azure-identity:${azureIdentityVersion}" - api "com.google.guava:guava:${guavaVersion}" - api "com.github.f4b6a3:ulid-creator:${ulidVersion}" - api "org.apache.commons:commons-lang3" - api "com.squareup:javapoet:${javapoetVersion}" - - compileOnly "javax.enterprise:cdi-api:${cdi}" - implementation "com.google.auto.service:auto-service:${autoServiceVersion}" - annotationProcessor "com.google.auto.service:auto-service:${autoServiceVersion}" + api "org.springframework.boot:spring-boot-autoconfigure" + api "org.springframework.data:spring-data-redis:${sdrVersion}" + api "org.springframework:spring-aop" + api "org.springframework:spring-context-support" + api "org.aspectj:aspectjweaver" + api "org.hibernate.validator:hibernate-validator" + api "jakarta.persistence:jakarta.persistence-api" + api "com.fasterxml.jackson.core:jackson-databind" + api "redis.clients:jedis" + api "com.azure:azure-identity:${azureIdentityVersion}" + api "com.google.guava:guava:${guavaVersion}" + api "com.github.f4b6a3:ulid-creator:${ulidVersion}" + api "org.apache.commons:commons-lang3" + api "com.squareup:javapoet:${javapoetVersion}" + compileOnly "javax.enterprise:cdi-api:${cdi}" + implementation "com.google.auto.service:auto-service:${autoServiceVersion}" + annotationProcessor "com.google.auto.service:auto-service:${autoServiceVersion}" } diff --git a/spotless.gradle b/spotless.gradle new file mode 100644 index 000000000..0589919cd --- /dev/null +++ b/spotless.gradle @@ -0,0 +1,43 @@ +// Spotless configuration +apply plugin: 'com.diffplug.spotless' + +spotless { + // Format Gradle files + groovyGradle { + target fileTree('.') { + include '**/*.gradle' + exclude '**/build/**', + '**/generated/**', + '**/target/**', + '**/.mvn/**', + '**/demos/**/.mvn/**' + } + greclipse() + } + + // Target all Java files within the project + java { + target fileTree('.') { + include '**/*.java' + exclude '**/build/**', + '**/generated/**', + '**/target/**', + '**/test/**', + '**/.mvn/**', + '**/demos/**/.mvn/**' // Skip build output, generated files, and .mvn folders + } + + // Use Eclipse formatter with custom config + eclipse().configFile("${rootDir}/.spotless/roms-style.xml") + removeUnusedImports() + importOrder('java', 'javax', 'org', 'com', '') + } + + lineEndings = 'UNIX' + encoding 'UTF-8' +} + +// Add dependency for the Gradle task execution order +tasks.named('spotlessGroovyGradle') { + mustRunAfter 'spotlessJava' +} \ No newline at end of file diff --git a/tests/build.gradle b/tests/build.gradle index d4ac97fa3..c9c876935 100644 --- a/tests/build.gradle +++ b/tests/build.gradle @@ -1,105 +1,105 @@ plugins { - id 'java' + id 'java' } apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } } // Don't publish this module bootJar { enabled = false } jar { enabled = false } tasks.matching { it.name.startsWith('publish') }.configureEach { - enabled = false + enabled = false } repositories { - mavenLocal() - mavenCentral() + mavenLocal() + mavenCentral() } // Tell gradle to add the generated sources directory sourceSets { - test { - java { - srcDir file("${buildDir}/generated/sources/annotationProcessor/java/test") - } - } + test { + java { + srcDir file("${buildDir}/generated/sources/annotationProcessor/java/test") + } + } } dependencies { - implementation project(':redis-om-spring') - implementation project(':redis-om-spring-ai') - - // Important for RedisOM annotation processing! - annotationProcessor project(':redis-om-spring') - testAnnotationProcessor project(':redis-om-spring') - - // Lombok - compileOnly 'org.projectlombok:lombok' - annotationProcessor 'org.projectlombok:lombok' - testCompileOnly 'org.projectlombok:lombok' - testAnnotationProcessor 'org.projectlombok:lombok' - - // Spring - implementation 'org.springframework:spring-context-support' - implementation 'org.springframework.boot:spring-boot-starter-test' - - // Spring AI - implementation "org.springframework.ai:spring-ai-openai:${springAiVersion}" - implementation "org.springframework.ai:spring-ai-ollama:${springAiVersion}" - implementation "org.springframework.ai:spring-ai-azure-openai:${springAiVersion}" - implementation "org.springframework.ai:spring-ai-vertex-ai-embedding:${springAiVersion}" - implementation "org.springframework.ai:spring-ai-bedrock:${springAiVersion}" - implementation "org.springframework.ai:spring-ai-transformers:${springAiVersion}" - implementation "org.springframework.ai:spring-ai-mistral-ai:${springAiVersion}" - implementation "org.springframework.ai:spring-ai-minimax:${springAiVersion}" - implementation "org.springframework.ai:spring-ai-zhipuai:${springAiVersion}" - - // WebSocket - implementation 'jakarta.websocket:jakarta.websocket-api:2.1.1' - implementation 'jakarta.websocket:jakarta.websocket-client-api:2.1.1' - - // DJL - implementation "ai.djl.spring:djl-spring-boot-starter-autoconfigure:${djlStarterVersion}" - implementation "ai.djl.spring:djl-spring-boot-starter-pytorch-auto:${djlStarterVersion}" - implementation "ai.djl.huggingface:tokenizers:${djlVersion}" - - // Test - testImplementation 'org.junit.jupiter:junit-jupiter' - testImplementation 'org.assertj:assertj-core' - testImplementation 'org.mockito:mockito-core' - testImplementation "com.redis:testcontainers-redis:${testcontainersRedisVersion}" - testImplementation "com.karuslabs:elementary:${elementaryVersion}" - testImplementation "org.testcontainers:junit-jupiter" - - // Other - implementation 'com.fasterxml.jackson.core:jackson-databind' - compileOnly "javax.enterprise:cdi-api:${cdi}" + implementation project(':redis-om-spring') + implementation project(':redis-om-spring-ai') + + // Important for RedisOM annotation processing! + annotationProcessor project(':redis-om-spring') + testAnnotationProcessor project(':redis-om-spring') + + // Lombok + compileOnly 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' + testCompileOnly 'org.projectlombok:lombok' + testAnnotationProcessor 'org.projectlombok:lombok' + + // Spring + implementation 'org.springframework:spring-context-support' + implementation 'org.springframework.boot:spring-boot-starter-test' + + // Spring AI + implementation "org.springframework.ai:spring-ai-openai:${springAiVersion}" + implementation "org.springframework.ai:spring-ai-ollama:${springAiVersion}" + implementation "org.springframework.ai:spring-ai-azure-openai:${springAiVersion}" + implementation "org.springframework.ai:spring-ai-vertex-ai-embedding:${springAiVersion}" + implementation "org.springframework.ai:spring-ai-bedrock:${springAiVersion}" + implementation "org.springframework.ai:spring-ai-transformers:${springAiVersion}" + implementation "org.springframework.ai:spring-ai-mistral-ai:${springAiVersion}" + implementation "org.springframework.ai:spring-ai-minimax:${springAiVersion}" + implementation "org.springframework.ai:spring-ai-zhipuai:${springAiVersion}" + + // WebSocket + implementation 'jakarta.websocket:jakarta.websocket-api:2.1.1' + implementation 'jakarta.websocket:jakarta.websocket-client-api:2.1.1' + + // DJL + implementation "ai.djl.spring:djl-spring-boot-starter-autoconfigure:${djlStarterVersion}" + implementation "ai.djl.spring:djl-spring-boot-starter-pytorch-auto:${djlStarterVersion}" + implementation "ai.djl.huggingface:tokenizers:${djlVersion}" + + // Test + testImplementation 'org.junit.jupiter:junit-jupiter' + testImplementation 'org.assertj:assertj-core' + testImplementation 'org.mockito:mockito-core' + testImplementation "com.redis:testcontainers-redis:${testcontainersRedisVersion}" + testImplementation "com.karuslabs:elementary:${elementaryVersion}" + testImplementation "org.testcontainers:junit-jupiter" + + // Other + implementation 'com.fasterxml.jackson.core:jackson-databind' + compileOnly "javax.enterprise:cdi-api:${cdi}" } // Use -parameters flag for Spring tasks.withType(JavaCompile).configureEach { - options.compilerArgs << '-parameters' + options.compilerArgs << '-parameters' } // Configure annotation processing compileTestJava { - options.annotationProcessorPath = configurations.testAnnotationProcessor - options.annotationProcessorGeneratedSourcesDirectory = file("${buildDir}/generated/sources/annotationProcessor/java/test") + options.annotationProcessorPath = configurations.testAnnotationProcessor + options.annotationProcessorGeneratedSourcesDirectory = file("${buildDir}/generated/sources/annotationProcessor/java/test") } test { - useJUnitPlatform() - maxHeapSize = "1g" + useJUnitPlatform() + maxHeapSize = "1g" - testLogging { - events "passed", "skipped", "failed" - exceptionFormat = 'full' - } + testLogging { + events "passed", "skipped", "failed" + exceptionFormat = 'full' + } } \ No newline at end of file