Skip to content

Commit 7df3875

Browse files
authored
Merge pull request #2 from devondragon/issue-1-Revise-Java-Version-from-21-to-17-for-greater-project-compatability
Changed JDK requirement from 21 to 17+
2 parents 99515e3 + 104c167 commit 7df3875

3 files changed

Lines changed: 47 additions & 5 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The Spring AI Client Library is a simple and efficient library for interacting w
1919

2020
### Prerequisites
2121

22-
- Java 21
22+
- Java 17 or later
2323
- Gradle 8.10.1 or Maven 3.8.1+
2424
- OpenAI API Key
2525

@@ -35,7 +35,7 @@ Add the following dependency to your `pom.xml`:
3535
<dependency>
3636
<groupId>com.digitalsanctuary</groupId>
3737
<artifactId>spring-ai-client</artifactId>
38-
<version>1.0.1</version>
38+
<version>1.1.0</version>
3939
</dependency>
4040
```
4141

@@ -45,7 +45,7 @@ Add the following dependency to your `build.gradle`:
4545

4646
```groovy
4747
dependencies {
48-
implementation 'com.digitalsanctuary:spring-ai-client:1.0.1'
48+
implementation 'com.digitalsanctuary:spring-ai-client:1.1.0'
4949
}
5050
```
5151

build.gradle

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import com.vanniktech.maven.publish.JavaLibrary
1313
import com.vanniktech.maven.publish.JavadocJar
1414

1515
group 'com.digitalsanctuary.springaiclient'
16-
version '1.0.1'
16+
version '1.1.0'
1717
description = 'Simple SpringBoot AI Client Library'
1818

1919
ext {
@@ -23,7 +23,7 @@ ext {
2323

2424
java {
2525
toolchain {
26-
languageVersion = JavaLanguageVersion.of(21)
26+
languageVersion = JavaLanguageVersion.of(17)
2727
}
2828
}
2929

@@ -63,6 +63,41 @@ tasks.named('jar') {
6363
archiveClassifier.set('')
6464
}
6565

66+
// Run tests with different JDK versions
67+
tasks.register('testJdk17', Test) {
68+
javaLauncher = javaToolchains.launcherFor {
69+
languageVersion = JavaLanguageVersion.of(17)
70+
}
71+
testClassesDirs = sourceSets.test.output.classesDirs
72+
classpath = sourceSets.test.runtimeClasspath
73+
useJUnitPlatform()
74+
doFirst {
75+
println("Running tests with JDK 17")
76+
}
77+
}
78+
79+
tasks.register('testJdk21', Test) {
80+
javaLauncher = javaToolchains.launcherFor {
81+
languageVersion = JavaLanguageVersion.of(21)
82+
}
83+
testClassesDirs = sourceSets.test.output.classesDirs
84+
classpath = sourceSets.test.runtimeClasspath
85+
useJUnitPlatform()
86+
doFirst {
87+
println("Running tests with JDK 21")
88+
}
89+
}
90+
91+
// Task that runs both test tasks
92+
tasks.register('testAll') {
93+
dependsOn(tasks.named('testJdk17'), tasks.named('testJdk21'))
94+
}
95+
96+
// Ensure the default 'test' task triggers both test tasks
97+
tasks.test {
98+
dependsOn(tasks.named('testAll'))
99+
}
100+
66101
// Maven Central Publishing Tasks
67102
mavenPublishing {
68103
configure(new JavaLibrary(new JavadocJar.Javadoc(), true))

src/test/java/com/digitalsanctuary/springaiclient/adapters/openai/service/OpenAIServiceTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.digitalsanctuary.springaiclient.adapters.openai.service;
22

33
import static org.junit.jupiter.api.Assertions.assertNotNull;
4+
import org.junit.jupiter.api.BeforeAll;
45
import org.junit.jupiter.api.Test;
56
import org.springframework.beans.factory.annotation.Autowired;
67
import org.springframework.boot.test.context.SpringBootTest;
@@ -18,6 +19,12 @@ class OpenAIServiceTest {
1819
@Autowired
1920
private OpenAIService openAIService;
2021

22+
23+
@BeforeAll
24+
public static void logJdkVersion() {
25+
log.info("Running tests with JDK version: " + System.getProperty("java.version"));
26+
}
27+
2128
@Test
2229
void testSendSimpleRequest() {
2330
log.info(null != openAIService ? "OpenAI service is not null" : "OpenAI service is null");

0 commit comments

Comments
 (0)