Skip to content

Commit 1101e43

Browse files
committed
fix test
1 parent 7c1fcb4 commit 1101e43

File tree

5 files changed

+45
-45
lines changed

5 files changed

+45
-45
lines changed

http-client/pom.xml

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
35
<modelVersion>4.0.0</modelVersion>
46
<parent>
57
<groupId>io.avaje</groupId>
@@ -113,48 +115,44 @@
113115
<groupId>org.apache.maven.plugins</groupId>
114116
<artifactId>maven-compiler-plugin</artifactId>
115117
<version>3.14.1</version>
118+
<configuration>
119+
<annotationProcessorPaths>
120+
<path>
121+
<groupId>io.avaje</groupId>
122+
<artifactId>avaje-inject-generator</artifactId>
123+
<version>12.0</version>
124+
</path>
125+
</annotationProcessorPaths>
126+
</configuration>
116127
<executions>
117128
<execution>
118-
<id>default-testCompile</id>
119-
<configuration>
120-
<annotationProcessorPaths>
121-
<path>
122-
<groupId>io.avaje</groupId>
123-
<artifactId>avaje-inject-generator</artifactId>
124-
<version>12.0</version>
125-
</path>
126-
</annotationProcessorPaths>
127-
</configuration>
128-
</execution>
129-
<!-- Compile for base version Java 11 -->
130-
<execution>
131-
<id>base</id>
132-
<goals>
133-
<goal>compile</goal>
134-
</goals>
135-
<configuration>
136-
<release>11</release>
137-
<compileSourceRoots>
138-
<compileSourceRoot>${project.basedir}/src/main/java</compileSourceRoot>
139-
</compileSourceRoots>
140-
</configuration>
141-
</execution>
142-
<!-- Compile for Java 21 -->
143-
<execution>
144-
<id>java21</id>
129+
<id>compile-java-21</id>
130+
<phase>compile</phase>
145131
<goals>
146132
<goal>compile</goal>
147133
</goals>
148134
<configuration>
149135
<release>21</release>
150136
<compileSourceRoots>
151-
<compileSourceRoot>${project.basedir}/src/main/java21</compileSourceRoot>
137+
<compileSourceRoot>
138+
${project.basedir}/src/main/java21</compileSourceRoot>
152139
</compileSourceRoots>
153-
<outputDirectory>${project.build.outputDirectory}/META-INF/versions/21</outputDirectory>
140+
<multiReleaseOutput>true</multiReleaseOutput>
154141
</configuration>
155142
</execution>
156143
</executions>
157144
</plugin>
145+
<plugin>
146+
<groupId>org.apache.maven.plugins</groupId>
147+
<artifactId>maven-jar-plugin</artifactId>
148+
<configuration>
149+
<archive>
150+
<manifestEntries>
151+
<Multi-Release>true</Multi-Release>
152+
</manifestEntries>
153+
</archive>
154+
</configuration>
155+
</plugin>
158156

159157
<!-- generated by avaje inject -->
160158
<plugin>

http-client/src/main/java/io/avaje/http/client/DHttpClientBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ private java.net.http.HttpClient defaultClient() {
103103
}
104104
if (executor != null) {
105105
builder.executor(executor);
106-
} else if (Integer.getInteger("java.specification.version") >= 21) {
107-
builder.executor(VirtualThreadExecutor.getVTExecutor());
106+
} else if (Runtime.version().feature() >= 21) {
107+
builder.executor(HttpExecutor.getExecutor());
108108
}
109109
if (proxy != null) {
110110
builder.proxy(proxy);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package io.avaje.http.client;
2+
3+
import java.util.concurrent.ExecutorService;
4+
import java.util.concurrent.Executors;
5+
6+
final class HttpExecutor {
7+
private HttpExecutor() {}
8+
//only executed in tests
9+
static ExecutorService getExecutor() {
10+
return Executors.newCachedThreadPool();
11+
}
12+
}

http-client/src/main/java/io/avaje/http/client/VirtualThreadExecutor.java

Lines changed: 0 additions & 10 deletions
This file was deleted.

http-client/src/main/java21/io/avaje/http/client/VirtualThreadExecutor.java renamed to http-client/src/main/java21/io/avaje/http/client/HttpExecutor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import java.util.concurrent.ExecutorService;
44
import java.util.concurrent.Executors;
55

6-
final class VirtualThreadExecutor {
7-
private VirtualThreadExecutor() {}
8-
static ExecutorService getVTExecutor() {
6+
final class HttpExecutor {
7+
private HttpExecutor() {}
8+
static ExecutorService getExecutor() {
99
return Executors.newVirtualThreadPerTaskExecutor();
1010
}
1111
}

0 commit comments

Comments
 (0)