Skip to content

Commit f073908

Browse files
timis1timis1
andauthored
JAVA-33839 Convert kotlin-self-executable-jar from gradle to maven (#888)
Co-authored-by: timis1 <[email protected]>
1 parent 70493f7 commit f073908

File tree

5 files changed

+248
-4
lines changed

5 files changed

+248
-4
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<artifactId>kotlin-executable-jar</artifactId>
6+
<name>kotlin-executable-jar</name>
7+
<packaging>jar</packaging>
8+
9+
<parent>
10+
<groupId>com.baeldung</groupId>
11+
<artifactId>kotlin-self-executable-jar</artifactId>
12+
<version>1.0-SNAPSHOT</version>
13+
<relativePath>../../kotlin-self-executable-jar</relativePath>
14+
</parent>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>org.jetbrains.kotlin</groupId>
19+
<artifactId>kotlin-stdlib</artifactId>
20+
<version>${kotlin.version}</version>
21+
</dependency>
22+
<dependency>
23+
<groupId>io.ktor</groupId>
24+
<artifactId>ktor-server-core</artifactId>
25+
<version>${ktor.version}</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>io.ktor</groupId>
29+
<artifactId>ktor-server-netty</artifactId>
30+
<version>${ktor.version}</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>ch.qos.logback</groupId>
34+
<artifactId>logback-classic</artifactId>
35+
<version>${logback.version}</version>
36+
</dependency>
37+
<dependency>
38+
<groupId>io.ktor</groupId>
39+
<artifactId>ktor-server-test-host</artifactId>
40+
<version>${ktor.version}</version>
41+
<scope>test</scope>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.jetbrains.kotlin</groupId>
45+
<artifactId>kotlin-test</artifactId>
46+
<version>${kotlin.version}</version>
47+
<scope>test</scope>
48+
</dependency>
49+
</dependencies>
50+
51+
<build>
52+
<sourceDirectory>src/main/kotlin</sourceDirectory>
53+
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
54+
<plugins>
55+
<!-- Kotlin Maven Plugin -->
56+
<plugin>
57+
<groupId>org.jetbrains.kotlin</groupId>
58+
<artifactId>kotlin-maven-plugin</artifactId>
59+
<version>${kotlin.version}</version>
60+
<executions>
61+
<execution>
62+
<id>compile</id>
63+
<goals>
64+
<goal>compile</goal>
65+
</goals>
66+
</execution>
67+
<execution>
68+
<id>test-compile</id>
69+
<phase>test-compile</phase>
70+
<goals>
71+
<goal>test-compile</goal>
72+
</goals>
73+
</execution>
74+
</executions>
75+
</plugin>
76+
</plugins>
77+
</build>
78+
79+
<properties>
80+
<kotlin.version>1.6.0</kotlin.version>
81+
<ktor.version>1.6.5</ktor.version>
82+
<logback.version>1.2.7</logback.version>
83+
</properties>
84+
85+
</project>
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<artifactId>kotlin-spring-executable</artifactId>
6+
<name>kotlin-spring-executable</name>
7+
<packaging>jar</packaging>
8+
9+
<parent>
10+
<groupId>com.baeldung</groupId>
11+
<artifactId>kotlin-self-executable-jar</artifactId>
12+
<version>1.0-SNAPSHOT</version>
13+
<relativePath>../../kotlin-self-executable-jar</relativePath>
14+
</parent>
15+
16+
<dependencies>
17+
<!-- Spring Boot Starter WebFlux -->
18+
<dependency>
19+
<groupId>org.springframework.boot</groupId>
20+
<artifactId>spring-boot-starter-webflux</artifactId>
21+
<version>${spring-boot.version}</version>
22+
</dependency>
23+
<!-- Jackson Module Kotlin -->
24+
<dependency>
25+
<groupId>com.fasterxml.jackson.module</groupId>
26+
<artifactId>jackson-module-kotlin</artifactId>
27+
<version>2.14.0</version>
28+
</dependency>
29+
<!-- Reactor Kotlin Extensions -->
30+
<dependency>
31+
<groupId>io.projectreactor.kotlin</groupId>
32+
<artifactId>reactor-kotlin-extensions</artifactId>
33+
<version>1.1.5</version>
34+
</dependency>
35+
<!-- Kotlin Reflect -->
36+
<dependency>
37+
<groupId>org.jetbrains.kotlin</groupId>
38+
<artifactId>kotlin-reflect</artifactId>
39+
<version>${kotlin.version}</version>
40+
</dependency>
41+
<!-- Kotlin Stdlib JDK8 -->
42+
<dependency>
43+
<groupId>org.jetbrains.kotlin</groupId>
44+
<artifactId>kotlin-stdlib-jdk8</artifactId>
45+
<version>${kotlin.version}</version>
46+
</dependency>
47+
<!-- Kotlin Coroutines Reactor -->
48+
<dependency>
49+
<groupId>org.jetbrains.kotlinx</groupId>
50+
<artifactId>kotlinx-coroutines-reactor</artifactId>
51+
<version>1.7.0</version>
52+
</dependency>
53+
<!-- Spring Boot Starter Test -->
54+
<dependency>
55+
<groupId>org.springframework.boot</groupId>
56+
<artifactId>spring-boot-starter-test</artifactId>
57+
<version>${spring-boot.version}</version>
58+
<scope>test</scope>
59+
<exclusions>
60+
<exclusion>
61+
<groupId>org.junit.vintage</groupId>
62+
<artifactId>junit-vintage-engine</artifactId>
63+
</exclusion>
64+
<exclusion>
65+
<artifactId>mockito-core</artifactId>
66+
<groupId>org.mockito</groupId>
67+
</exclusion>
68+
</exclusions>
69+
</dependency>
70+
<!-- Reactor Test -->
71+
<dependency>
72+
<groupId>io.projectreactor</groupId>
73+
<artifactId>reactor-test</artifactId>
74+
<version>3.4.12</version>
75+
<scope>test</scope>
76+
</dependency>
77+
<!-- JUnit Jupiter API -->
78+
<dependency>
79+
<groupId>org.junit.jupiter</groupId>
80+
<artifactId>junit-jupiter-api</artifactId>
81+
<version>5.8.1</version>
82+
<scope>test</scope>
83+
</dependency>
84+
<!-- JUnit Jupiter Engine -->
85+
<dependency>
86+
<groupId>org.junit.jupiter</groupId>
87+
<artifactId>junit-jupiter-engine</artifactId>
88+
<version>5.8.1</version>
89+
<scope>test</scope>
90+
</dependency>
91+
</dependencies>
92+
93+
<build>
94+
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
95+
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
96+
<plugins>
97+
<!-- Kotlin Maven Plugin -->
98+
<plugin>
99+
<groupId>org.jetbrains.kotlin</groupId>
100+
<artifactId>kotlin-maven-plugin</artifactId>
101+
<version>${kotlin.version}</version>
102+
<executions>
103+
<execution>
104+
<id>compile</id>
105+
<goals>
106+
<goal>compile</goal>
107+
</goals>
108+
</execution>
109+
<execution>
110+
<id>test-compile</id>
111+
<phase>test-compile</phase>
112+
<goals>
113+
<goal>test-compile</goal>
114+
</goals>
115+
</execution>
116+
</executions>
117+
</plugin>
118+
<plugin>
119+
<groupId>org.apache.maven.plugins</groupId>
120+
<artifactId>maven-surefire-plugin</artifactId>
121+
<version>2.19.1</version>
122+
<dependencies>
123+
<dependency>
124+
<groupId>org.junit.platform</groupId>
125+
<artifactId>junit-platform-surefire-provider</artifactId>
126+
<version>1.0.3</version>
127+
</dependency>
128+
<dependency>
129+
<groupId>org.junit.jupiter</groupId>
130+
<artifactId>junit-jupiter-engine</artifactId>
131+
<version>5.8.1</version>
132+
</dependency>
133+
</dependencies>
134+
</plugin>
135+
</plugins>
136+
</build>
137+
138+
<properties>
139+
<spring-boot.version>2.6.0</spring-boot.version>
140+
<kotlin.version>1.8.0</kotlin.version>
141+
<java.version>11</java.version>
142+
</properties>
143+
144+
</project>

kotlin-self-executable-jar/kotlin-spring-executable/src/main/kotlin/com/baeldung/kotlinspringexecutable/web/JokeController.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ class JokeController(resource: String) {
2121
}
2222

2323
@Configuration
24-
class RouterConfiguration {
24+
open class RouterConfiguration {
2525
@Bean
26-
fun controller() = JokeController("/list-of-jokes.txt")
26+
open fun controller() = JokeController("/list-of-jokes.txt")
2727

2828
@Bean
29-
fun mainRoute(controller: JokeController): RouterFunction<ServerResponse> = coRouter {
29+
open fun mainRoute(controller: JokeController): RouterFunction<ServerResponse> = coRouter {
3030
GET("/", controller::handleGet)
3131
}
3232
}

kotlin-self-executable-jar/pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>com.baeldung</groupId>
6+
<artifactId>kotlin-self-executable-jar</artifactId>
7+
<version>1.0-SNAPSHOT</version>
8+
<packaging>pom</packaging>
9+
10+
<modules>
11+
<module>kotlin-executable-jar</module>
12+
<module>kotlin-spring-executable</module>
13+
</modules>
14+
15+
</project>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@
392392
<module>kotlin-quasar</module>
393393
<module>kotlin-reflection</module>
394394
<module>kotlin-rsocket</module>
395-
<!-- <module>kotlin-self-executable-jar</module> --> <!-- not a Maven module -->
395+
<module>kotlin-self-executable-jar</module>
396396
<module>kotlin-spark</module>
397397
<module>kotlin-testing</module>
398398
<module>kotlin-testing-2</module>

0 commit comments

Comments
 (0)