Skip to content

Commit 71fbb2d

Browse files
committed
Upgrade to Vert.x 5
1 parent 6008525 commit 71fbb2d

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ repositories {
1414
mavenCentral()
1515
}
1616

17-
val vertxVersion = "4.0.3"
17+
val vertxVersion = "5.0.0.CR2"
1818
val junitJupiterVersion = "5.7.0"
1919

2020
val mainVerticleName = "com.example.container_uber_jar.MainVerticle"
21-
val launcherClassName = "io.vertx.core.Launcher"
21+
val launcherClassName = "io.vertx.launcher.application.VertxApplication"
2222

2323
val watchForChange = "src/**/*"
2424
val doOnChange = "${projectDir}/gradlew classes"
@@ -30,6 +30,7 @@ application {
3030
dependencies {
3131
implementation(platform("io.vertx:vertx-stack-depchain:$vertxVersion"))
3232
implementation("io.vertx:vertx-core")
33+
implementation("io.vertx:vertx-launcher-application")
3334
testImplementation("io.vertx:vertx-junit5")
3435
testImplementation("org.junit.jupiter:junit-jupiter:$junitJupiterVersion")
3536
}

pom.xml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
<properties>
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1313

14-
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
14+
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
1515
<maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
1616
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
17-
<exec-maven-plugin.version>3.0.0</exec-maven-plugin.version>
17+
<exec-maven-plugin.version>3.5.0</exec-maven-plugin.version>
1818

19-
<vertx.version>4.0.3</vertx.version>
19+
<vertx.version>5.0.0.CR2</vertx.version>
2020
<junit-jupiter.version>5.7.0</junit-jupiter.version>
2121

2222
<main.verticle>com.example.container_uber_jar.MainVerticle</main.verticle>
23-
<launcher.class>io.vertx.core.Launcher</launcher.class>
23+
<launcher.class>io.vertx.launcher.application.VertxApplication</launcher.class>
2424
</properties>
2525

2626
<dependencyManagement>
@@ -40,6 +40,10 @@
4040
<groupId>io.vertx</groupId>
4141
<artifactId>vertx-core</artifactId>
4242
</dependency>
43+
<dependency>
44+
<groupId>io.vertx</groupId>
45+
<artifactId>vertx-launcher-application</artifactId>
46+
</dependency>
4347

4448
<dependency>
4549
<groupId>io.vertx</groupId>
Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
package com.example.container_uber_jar;
22

3-
import io.vertx.core.AbstractVerticle;
4-
import io.vertx.core.Promise;
3+
import io.vertx.core.Future;
4+
import io.vertx.core.VerticleBase;
55

6-
public class MainVerticle extends AbstractVerticle {
6+
public class MainVerticle extends VerticleBase {
77

88
@Override
9-
public void start(Promise<Void> startPromise) throws Exception {
10-
vertx.createHttpServer().requestHandler(req -> {
11-
req.response()
12-
.putHeader("content-type", "text/plain")
13-
.end("Hello from Vert.x!");
14-
}).listen(8888, http -> {
15-
if (http.succeeded()) {
16-
startPromise.complete();
17-
System.out.println("HTTP server started on port 8888");
18-
} else {
19-
startPromise.fail(http.cause());
20-
}
21-
});
9+
public Future<?> start() {
10+
return vertx.createHttpServer().requestHandler(req -> {
11+
req.response()
12+
.putHeader("content-type", "text/plain")
13+
.end("Hello from Vert.x!");
14+
})
15+
.listen(8888)
16+
.onSuccess(v -> System.out.println("HTTP server started on port 8888"));
2217
}
2318
}

src/test/java/com/example/container_uber_jar/TestMainVerticle.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ public class TestMainVerticle {
1212

1313
@BeforeEach
1414
void deploy_verticle(Vertx vertx, VertxTestContext testContext) {
15-
vertx.deployVerticle(new MainVerticle(), testContext.succeeding(id -> testContext.completeNow()));
15+
vertx.deployVerticle(new MainVerticle()).onComplete(testContext.succeeding(id -> testContext.completeNow()));
1616
}
1717

1818
@Test
19-
void verticle_deployed(Vertx vertx, VertxTestContext testContext) throws Throwable {
19+
void verticle_deployed(Vertx vertx, VertxTestContext testContext) {
2020
testContext.completeNow();
2121
}
2222
}

0 commit comments

Comments
 (0)