Skip to content

Commit 42974d1

Browse files
committed
Added jvm rainbow
1 parent 757a629 commit 42974d1

File tree

8 files changed

+326
-0
lines changed

8 files changed

+326
-0
lines changed

README.MD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ A repository containing different java tutorials
4242
## Serialization & Deserialization ☢️
4343
- [Two-way object serialization while using one model with Jackson and Spring Boot](two-way-object-serialization)
4444

45+
## Miscellaneous 🎭
46+
- [JVM Rainbow - Mixing Java, Kotlin, Scala and Groovy](jvm-rainbow)
47+
4548
# Contributing
4649

4750
There are plenty of ways to contribute to this project:

jvm-rainbow/pom.xml

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
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">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>io.github.hakky54</groupId>
9+
<artifactId>java-tutorials</artifactId>
10+
<version>1.0.0-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>jvm-rainbow</artifactId>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>org.jetbrains.kotlin</groupId>
18+
<artifactId>kotlin-stdlib</artifactId>
19+
<version>${version.kotlin}</version>
20+
</dependency>
21+
22+
<dependency>
23+
<groupId>org.scala-lang</groupId>
24+
<artifactId>scala-library</artifactId>
25+
<version>${version.scala-compiler}</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.scala-lang</groupId>
29+
<artifactId>scala-compiler</artifactId>
30+
<version>${version.scala-compiler}</version>
31+
</dependency>
32+
33+
<dependency>
34+
<groupId>org.apache.groovy</groupId>
35+
<artifactId>groovy</artifactId>
36+
<version>${version.groovy}</version>
37+
</dependency>
38+
39+
<dependency>
40+
<groupId>org.assertj</groupId>
41+
<artifactId>assertj-core</artifactId>
42+
<version>${version.assertj-core}</version>
43+
<scope>test</scope>
44+
</dependency>
45+
<dependency>
46+
<groupId>org.scalatest</groupId>
47+
<artifactId>scalatest_${version.scala}</artifactId>
48+
<version>${version.scalatest}</version>
49+
<scope>test</scope>
50+
</dependency>
51+
</dependencies>
52+
53+
<build>
54+
<plugins>
55+
<plugin>
56+
<groupId>org.apache.maven.plugins</groupId>
57+
<artifactId>maven-compiler-plugin</artifactId>
58+
<version>${version.maven-compiler-plugin}</version>
59+
<executions>
60+
<execution>
61+
<id>default-compile</id>
62+
<phase>none</phase>
63+
</execution>
64+
<execution>
65+
<id>default-testCompile</id>
66+
<phase>none</phase>
67+
</execution>
68+
<execution>
69+
<id>java-compile</id>
70+
<phase>compile</phase>
71+
<goals>
72+
<goal>compile</goal>
73+
</goals>
74+
</execution>
75+
<execution>
76+
<id>java-test-compile</id>
77+
<phase>test-compile</phase>
78+
<goals>
79+
<goal>testCompile</goal>
80+
</goals>
81+
</execution>
82+
</executions>
83+
</plugin>
84+
85+
<plugin>
86+
<groupId>org.jetbrains.kotlin</groupId>
87+
<artifactId>kotlin-maven-plugin</artifactId>
88+
<version>${version.kotlin}</version>
89+
<configuration>
90+
<jvmTarget>11</jvmTarget>
91+
</configuration>
92+
<executions>
93+
<execution>
94+
<id>compile</id>
95+
<goals>
96+
<goal>compile</goal>
97+
</goals>
98+
<configuration>
99+
<sourceDirs>
100+
<sourceDir>${project.basedir}/src/main/java</sourceDir>
101+
</sourceDirs>
102+
</configuration>
103+
</execution>
104+
<execution>
105+
<id>test-compile</id>
106+
<goals>
107+
<goal>test-compile</goal>
108+
</goals>
109+
<configuration>
110+
<sourceDirs>
111+
<sourceDir>${project.basedir}/src/test/java</sourceDir>
112+
</sourceDirs>
113+
</configuration>
114+
</execution>
115+
</executions>
116+
</plugin>
117+
118+
<plugin>
119+
<groupId>net.alchim31.maven</groupId>
120+
<artifactId>scala-maven-plugin</artifactId>
121+
<version>${version.scala-maven-plugin}</version>
122+
<executions>
123+
<execution>
124+
<goals>
125+
<goal>compile</goal>
126+
<goal>testCompile</goal>
127+
</goals>
128+
</execution>
129+
</executions>
130+
</plugin>
131+
132+
<plugin>
133+
<groupId>org.codehaus.gmavenplus</groupId>
134+
<artifactId>gmavenplus-plugin</artifactId>
135+
<version>${version.gmavenplus-plugin}</version>
136+
<executions>
137+
<execution>
138+
<id>groovy</id>
139+
<goals>
140+
<goal>addSources</goal>
141+
<goal>addTestSources</goal>
142+
<goal>generateStubs</goal>
143+
<goal>compile</goal>
144+
<goal>generateTestStubs</goal>
145+
<goal>compileTests</goal>
146+
<goal>removeStubs</goal>
147+
<goal>removeTestStubs</goal>
148+
</goals>
149+
</execution>
150+
</executions>
151+
<configuration>
152+
<sources>
153+
<source>
154+
<directory>${project.basedir}/src/main/java</directory>
155+
<includes>
156+
<include>**/*.groovy</include>
157+
</includes>
158+
</source>
159+
</sources>
160+
<testSources>
161+
<testSource>
162+
<directory>${project.basedir}/src/test/java</directory>
163+
<includes>
164+
<include>**/*.groovy</include>
165+
</includes>
166+
</testSource>
167+
</testSources>
168+
</configuration>
169+
<dependencies>
170+
<dependency>
171+
<groupId>org.apache.groovy</groupId>
172+
<artifactId>groovy</artifactId>
173+
<version>${version.groovy}</version>
174+
<scope>runtime</scope>
175+
</dependency>
176+
</dependencies>
177+
</plugin>
178+
179+
<plugin>
180+
<groupId>org.scalatest</groupId>
181+
<artifactId>scalatest-maven-plugin</artifactId>
182+
<version>${version.scalatest-maven-plugin}</version>
183+
<executions>
184+
<execution>
185+
<id>test</id>
186+
<goals>
187+
<goal>test</goal>
188+
</goals>
189+
</execution>
190+
</executions>
191+
</plugin>
192+
193+
</plugins>
194+
</build>
195+
196+
</project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2022 Thunderberry.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package nl.altindag.jvm.rainbow;
17+
18+
public interface GreetingsService {
19+
20+
String hello();
21+
22+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2022 Thunderberry.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package nl.altindag.jvm.rainbow;
17+
18+
class GroovyService implements GreetingsService {
19+
20+
@Override
21+
String hello() {
22+
"hello"
23+
}
24+
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2022 Thunderberry.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package nl.altindag.jvm.rainbow;
17+
18+
public class JavaService implements GreetingsService {
19+
20+
@Override
21+
public String hello() {
22+
return "hello";
23+
}
24+
25+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2022 Thunderberry.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package nl.altindag.jvm.rainbow
17+
18+
class KotlinService : GreetingsService {
19+
20+
override fun hello(): String? {
21+
return "hello"
22+
}
23+
24+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2022 Thunderberry.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package nl.altindag.jvm.rainbow
17+
18+
class ScalaService extends GreetingsService {
19+
20+
override def hello(): String = "hello"
21+
22+
}

pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<module>instant-ssl-reloading-with-spring-tomcat</module>
2626
<module>bypassing-overruling-ssl-configuration</module>
2727
<module>trust-me</module>
28+
<module>jvm-rainbow</module>
2829
</modules>
2930

3031
<licenses>
@@ -49,10 +50,17 @@
4950

5051
<properties>
5152
<version.java>21</version.java>
53+
<version.kotlin>2.0.0</version.kotlin>
54+
<version.scala>2.13</version.scala>
55+
<version.groovy>4.0.27</version.groovy>
5256
<version.maven-surefire-plugin>3.0.0-M7</version.maven-surefire-plugin>
5357
<version.maven-fail-safe>3.0.0-M7</version.maven-fail-safe>
5458
<version.maven-compiler-plugin>3.10.1</version.maven-compiler-plugin>
5559
<version.maven-shade-plugin>3.4.1</version.maven-shade-plugin>
60+
<version.scala-compiler>2.13.14</version.scala-compiler>
61+
<version.scala-maven-plugin>4.9.1</version.scala-maven-plugin>
62+
<version.gmavenplus-plugin>4.2.0</version.gmavenplus-plugin>
63+
<version.scalatest-maven-plugin>2.2.0</version.scalatest-maven-plugin>
5664
<version.os-maven-plugin>1.7.1</version.os-maven-plugin>
5765
<version.protobuf-maven-plugin>0.6.1</version.protobuf-maven-plugin>
5866
<version.exec-maven-plugin>3.1.0</version.exec-maven-plugin>
@@ -93,6 +101,7 @@
93101
<version.byte-buddy>1.15.1</version.byte-buddy>
94102
<version.consolecaptor>1.0.3</version.consolecaptor>
95103
<version.postgresql>42.5.0</version.postgresql>
104+
<version.scalatest>3.2.19</version.scalatest>
96105
<version.testcontainers-postgresql>1.17.3</version.testcontainers-postgresql>
97106
</properties>
98107

0 commit comments

Comments
 (0)