Skip to content

Commit f3b22ba

Browse files
Add JDK-specific Maven profiles to support preview features in gpu-llama3
- Introduce profiles for JDK 21, 22-23, and 24+. - Ensure compatibility by targeting appropriate Java versions with preview features.
1 parent 8277c88 commit f3b22ba

File tree

1 file changed

+104
-24
lines changed
  • model-providers/gpu-llama3/runtime

1 file changed

+104
-24
lines changed

model-providers/gpu-llama3/runtime/pom.xml

Lines changed: 104 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -74,31 +74,111 @@
7474
</runnerParentFirstArtifacts>
7575
</configuration>
7676
</plugin>
77-
<plugin>
78-
<artifactId>maven-compiler-plugin</artifactId>
79-
<configuration>
80-
<!--
81-
In order for vector support to work on JDK 21+, we need to build the module with JDK 23,
82-
because in that version Vector is no longer preview, so we build target and runtime versions
83-
don't need to match (remember that preview features only work on the same runtime version as the target
84-
-->
85-
<source>21</source>
86-
<target>21</target>
87-
<release combine.self="override" /> <!-- make sure -release is not passed to javac-->
88-
<compilerArgs>
89-
<arg>--enable-preview</arg>
90-
<arg>--add-modules=jdk.incubator.vector</arg>
91-
</compilerArgs>
92-
<annotationProcessorPaths>
93-
<path>
94-
<groupId>io.quarkus</groupId>
95-
<artifactId>quarkus-extension-processor</artifactId>
96-
<version>${quarkus.version}</version>
97-
</path>
98-
</annotationProcessorPaths>
99-
</configuration>
100-
</plugin>
10177
</plugins>
10278
</build>
10379

80+
<profiles>
81+
<!-- Java 21: Enable preview features to match gpu-llama3 compilation -->
82+
<profile>
83+
<id>jdk21-with-preview</id>
84+
<activation>
85+
<jdk>21</jdk>
86+
</activation>
87+
<build>
88+
<plugins>
89+
<plugin>
90+
<artifactId>maven-compiler-plugin</artifactId>
91+
<configuration>
92+
<!--
93+
Target Java 21 with preview features to match gpu-llama3 dependency
94+
-->
95+
<source>21</source>
96+
<target>21</target>
97+
<release combine.self="override" /> <!-- make sure -release is not passed to javac-->
98+
<compilerArgs>
99+
<arg>--enable-preview</arg>
100+
<arg>--add-modules=jdk.incubator.vector</arg>
101+
</compilerArgs>
102+
<annotationProcessorPaths>
103+
<path>
104+
<groupId>io.quarkus</groupId>
105+
<artifactId>quarkus-extension-processor</artifactId>
106+
<version>${quarkus.version}</version>
107+
</path>
108+
</annotationProcessorPaths>
109+
</configuration>
110+
</plugin>
111+
</plugins>
112+
</build>
113+
</profile>
114+
115+
<!-- Java 22-23: Compile to Java 21 target for compatibility -->
116+
<profile>
117+
<id>jdk22-23-with-preview</id>
118+
<activation>
119+
<jdk>[22,23]</jdk>
120+
</activation>
121+
<build>
122+
<plugins>
123+
<plugin>
124+
<artifactId>maven-compiler-plugin</artifactId>
125+
<configuration>
126+
<!--
127+
Compile with JDK 22-23 but target Java 21 for compatibility
128+
-->
129+
<source>21</source>
130+
<target>21</target>
131+
<release combine.self="override" /> <!-- make sure -release is not passed to javac-->
132+
<compilerArgs>
133+
<arg>--enable-preview</arg>
134+
<arg>--add-modules=jdk.incubator.vector</arg>
135+
</compilerArgs>
136+
<annotationProcessorPaths>
137+
<path>
138+
<groupId>io.quarkus</groupId>
139+
<artifactId>quarkus-extension-processor</artifactId>
140+
<version>${quarkus.version}</version>
141+
</path>
142+
</annotationProcessorPaths>
143+
</configuration>
144+
</plugin>
145+
</plugins>
146+
</build>
147+
</profile>
148+
149+
<!-- Java 24+: Use current JDK's preview features -->
150+
<profile>
151+
<id>jdk24-plus</id>
152+
<activation>
153+
<jdk>[24,)</jdk>
154+
</activation>
155+
<build>
156+
<plugins>
157+
<plugin>
158+
<artifactId>maven-compiler-plugin</artifactId>
159+
<configuration>
160+
<!--
161+
Use JDK 24+ where preview features are supported for current version
162+
-->
163+
<source>24</source>
164+
<target>24</target>
165+
<release combine.self="override" /> <!-- make sure -release is not passed to javac-->
166+
<compilerArgs>
167+
<arg>--enable-preview</arg>
168+
<arg>--add-modules=jdk.incubator.vector</arg>
169+
</compilerArgs>
170+
<annotationProcessorPaths>
171+
<path>
172+
<groupId>io.quarkus</groupId>
173+
<artifactId>quarkus-extension-processor</artifactId>
174+
<version>${quarkus.version}</version>
175+
</path>
176+
</annotationProcessorPaths>
177+
</configuration>
178+
</plugin>
179+
</plugins>
180+
</build>
181+
</profile>
182+
</profiles>
183+
104184
</project>

0 commit comments

Comments
 (0)