Skip to content

Commit 4913661

Browse files
authored
Merge pull request #47 from avaje/JDK-24
JDK 24
2 parents ba1e3fb + f101391 commit 4913661

File tree

7 files changed

+16
-48
lines changed

7 files changed

+16
-48
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
java_version: [23]
15+
java_version: [24]
1616
os: [ubuntu-latest]
1717

1818
steps:

.github/workflows/jdk-ea.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name: JDK EA
33

44
on:
5+
push:
56
workflow_dispatch:
67
schedule:
78
- cron: '39 6 * * 1,3,5'
@@ -16,7 +17,7 @@ jobs:
1617
strategy:
1718
fail-fast: false
1819
matrix:
19-
java_version: [GA,EA] ## valhalla,metropolis don't support java 17
20+
java_version: [GA,EA]
2021
os: [ubuntu-latest]
2122

2223
steps:

README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![Supported JVM Versions](https://img.shields.io/badge/JVM-23-brightgreen.svg?&logo=openjdk)
1+
![Supported JVM Versions](https://img.shields.io/badge/JVM-24+-brightgreen.svg?&logo=openjdk)
22
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/avaje/avaje-inject/blob/master/LICENSE)
33
![Maven Central : avaje-provides-maven-plugin](https://img.shields.io/maven-central/v/io.avaje/avaje-provides-maven-plugin.svg?label=Maven%20Central)
44

@@ -8,10 +8,7 @@ Maven plugin that post-processes modular applications' `module-info.class` files
88

99
## How to use
1010

11-
### 1. Create a `.mvn/jvm.config` file
12-
This plugin uses the JDK 22 [Class-File API](https://openjdk.org/jeps/457). As the feature is still in preview, create a `.mvn/jvm.config` file and add `--enable-preview` so that the maven JVM will run with preview features.
13-
14-
### 2. Add the plugin to your pom.xml
11+
### 1. Add the plugin to your pom.xml
1512

1613
```xml
1714
<plugin>
@@ -31,25 +28,23 @@ Given a module-info like:
3128
```java
3229
module avaje.example {
3330
requires io.avaje.inject;
34-
requires io.avaje.jsonb;
3531

3632
requires static io.avaje.spi;
3733

3834
}
3935
```
4036

41-
And a `META-INF/my.example.SPIServiceInterface` file (either manually created or generated by APT):
37+
And a `META-INF/services/my.example.SPIServiceInterface` file (either manually created or generated by APT):
4238

4339
```
4440
my.example.SPIServiceInterfaceImpl
4541
```
46-
This goal will transform the module-info classfile after compilation to look like:
42+
43+
This goal will transform the module-info classfile after compilation to roughly look like:
4744

4845
```java
4946
module avaje.example {
5047
requires io.avaje.inject;
51-
requires io.avaje.jsonb;
52-
requires io.avaje.jsonb.plugin;
5348

5449
requires static io.avaje.spi;
5550
provides my.example.SPIServiceInterface with my.example.SPIServiceInterfaceImpl;

pom.xml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<groupId>io.avaje</groupId>
1212
<artifactId>avaje-provides-maven-plugin</artifactId>
1313
<packaging>maven-plugin</packaging>
14-
<version>1.2-SNAPSHOT</version>
14+
<version>2.0-SNAPSHOT</version>
1515
<properties>
16-
<maven.compiler.release>23</maven.compiler.release>
16+
<maven.compiler.release>24</maven.compiler.release>
1717
</properties>
1818

1919
<dependencies>
@@ -48,22 +48,10 @@
4848
<goalPrefix>avaje-provides</goalPrefix>
4949
</configuration>
5050
</plugin>
51-
<plugin>
52-
<groupId>org.apache.maven.plugins</groupId>
53-
<artifactId>maven-compiler-plugin</artifactId>
54-
<configuration>
55-
<compilerArgs>
56-
--enable-preview
57-
</compilerArgs>
58-
</configuration>
59-
</plugin>
6051
<plugin>
6152
<groupId>org.apache.maven.plugins</groupId>
6253
<artifactId>maven-javadoc-plugin</artifactId>
6354
<version>3.11.2</version>
64-
<configuration>
65-
<additionalOptions>--enable-preview</additionalOptions>
66-
</configuration>
6755
</plugin>
6856
</plugins>
6957
</build>

src/main/java/io/avaje/inject/mojo/DisableModuleValidationMojo.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,8 @@ public class DisableModuleValidationMojo extends AbstractMojo {
2929
@Override
3030
public void execute() throws MojoExecutionException {
3131

32-
var canRun =
33-
Integer.getInteger("java.specification.version") == 23
34-
&& ManagementFactory.getRuntimeMXBean().getInputArguments().stream()
35-
.anyMatch("--enable-preview"::equals);
36-
37-
if(!canRun) {
38-
getLog()
39-
.warn(
40-
"This version of the avaje-provides-plugin only works on JDK 23 with --enable-preview cofigured in MAVEN_OPTS");
32+
if (Integer.getInteger("java.specification.version") < 24) {
33+
getLog().error("This version of the avaje-provides-plugin only works on JDK 24 and up");
4134
return;
4235
}
4336

src/main/java/io/avaje/inject/mojo/ModuleSPIMojo.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package io.avaje.inject.mojo;
22

33
import java.io.File;
4-
import java.lang.management.ManagementFactory;
54
import java.nio.file.Files;
65
import java.util.HashSet;
7-
import java.util.List;
86
import java.util.Set;
97

108
import org.apache.maven.plugin.AbstractMojo;
@@ -24,15 +22,11 @@ public class ModuleSPIMojo extends AbstractMojo {
2422
@Override
2523
public void execute() throws MojoExecutionException {
2624

27-
var canRun =
28-
Integer.getInteger("java.specification.version") == 23
29-
&& ManagementFactory.getRuntimeMXBean().getInputArguments().stream()
30-
.anyMatch("--enable-preview"::equals);
3125

32-
if (!canRun) {
26+
if (Integer.getInteger("java.specification.version") < 24) {
3327
getLog()
34-
.warn(
35-
"This version of the avaje-provides-plugin only works on JDK 23 with --enable-preview cofigured in MAVEN_OPTS");
28+
.error(
29+
"This version of the avaje-provides-plugin only works on JDK 24 and up");
3630
return;
3731
}
3832

src/main/resources/META-INF/plexus/components.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<component>
55
<role>org.apache.maven.lifecycle.Lifecycle</role>
66
<implementation>org.apache.maven.lifecycle.Lifecycle</implementation>
7-
<role-hint>avaje-inject-maven-plugin</role-hint>
7+
<role-hint>avaje-provides-maven-plugin</role-hint>
88
<configuration>
99
<id>avaje-provides-maven-plugin</id>
1010
<phases>
@@ -14,9 +14,6 @@
1414
<process-resources>
1515
io.avaje:avaje-provides-maven-plugin:${project.version}:disable-apt-validation
1616
</process-resources>
17-
<process-sources>
18-
io.avaje:avaje-inject-maven-plugin:10.4:provides
19-
</process-sources>
2017
<process-classes>
2118
io.avaje:avaje-provides-maven-plugin:${project.version}:add-module-spi
2219
</process-classes>

0 commit comments

Comments
 (0)