Skip to content

Commit 5ee1ce9

Browse files
Merge pull request #100 from kghackers/feat/#81_migrate-to-kotlin
feat: #81 Migrate project to Kotlin (started the migration) feat: #102 Extract `kgCommon` module, turn off the legacy modules by default (you can enable them via a special maven profile). feat: #101 Kefir usage reduced, only left in the legacy modules.
2 parents bc94cc4 + 05d0671 commit 5ee1ce9

File tree

121 files changed

+2802
-1936
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+2802
-1936
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,19 @@ mvn compile
190190

191191
:exclamation: Now after making changes in `kgparserSrv`, you have to `mvn install`
192192
this module before running MapStruct in `kgstatsSrv`.
193+
194+
## Legacy modules and Maven profile
195+
196+
By default, the legacy modules `kgparserSrv` and `kgparserWeb` are excluded from the build.
197+
198+
If you want to turn them on, you have to switch on the Maven `legacy-kgparser` profile.
199+
200+
For example:
201+
202+
```bash
203+
mvn clean -P legacy-kgparser
204+
```
205+
206+
```bash
207+
mvn install -P legacy-kgparser
208+
```

kgCommon/pom.xml

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>ru.klavogonki.kgparser</groupId>
8+
<artifactId>kgparser</artifactId>
9+
<version>1.0</version>
10+
</parent>
11+
12+
<artifactId>kg-common</artifactId>
13+
<name>kg-common</name>
14+
<description>Common module with basic Klavogonki classes, uses by both legacy kgparser and kgstats.</description>
15+
16+
<!-- build as a trivial jar file -->
17+
<packaging>jar</packaging>
18+
19+
<dependencies>
20+
<dependency>
21+
<groupId>org.assertj</groupId>
22+
<artifactId>assertj-core</artifactId>
23+
</dependency>
24+
25+
<dependency>
26+
<groupId>com.fasterxml.jackson.core</groupId>
27+
<artifactId>jackson-core</artifactId>
28+
</dependency>
29+
30+
<dependency>
31+
<groupId>com.fasterxml.jackson.core</groupId>
32+
<artifactId>jackson-databind</artifactId>
33+
</dependency>
34+
<dependency>
35+
<groupId>com.fasterxml.jackson.core</groupId>
36+
<artifactId>jackson-annotations</artifactId>
37+
</dependency>
38+
39+
<dependency>
40+
<groupId>org.junit.jupiter</groupId>
41+
<artifactId>junit-jupiter-api</artifactId>
42+
</dependency>
43+
44+
<dependency>
45+
<groupId>org.junit.jupiter</groupId>
46+
<artifactId>junit-jupiter-engine</artifactId>
47+
</dependency>
48+
49+
<!-- mapstruct -->
50+
<dependency>
51+
<groupId>org.mapstruct</groupId>
52+
<artifactId>mapstruct</artifactId>
53+
</dependency>
54+
55+
<!-- 1 generator -->
56+
<dependency>
57+
<groupId>org.openapitools</groupId>
58+
<artifactId>jackson-databind-nullable</artifactId>
59+
<version>${jackson-databind-nullable-version}</version>
60+
</dependency>
61+
62+
<dependency>
63+
<groupId>io.swagger</groupId>
64+
<artifactId>swagger-annotations</artifactId>
65+
<version>${swagger-annotations-version}</version>
66+
</dependency>
67+
68+
</dependencies>
69+
70+
<build>
71+
<plugins>
72+
73+
<!-- see https://kotlinlang.org/docs/maven.html#compile-kotlin-and-java-sources -->
74+
<!-- see https://kotlinlang.org/docs/lombok.html#maven -->
75+
<plugin>
76+
<groupId>org.jetbrains.kotlin</groupId>
77+
<artifactId>kotlin-maven-plugin</artifactId>
78+
<version>${kotlin.version}</version>
79+
<extensions>true</extensions> <!-- You can set this option to automatically take information about lifecycles -->
80+
81+
<executions>
82+
<execution>
83+
<id>compile</id>
84+
<goals>
85+
<goal>compile</goal> <!-- You can skip the <goals> element if you enable extensions for the plugin -->
86+
</goals>
87+
<configuration>
88+
<sourceDirs>
89+
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
90+
<sourceDir>${project.basedir}/src/main/java</sourceDir>
91+
</sourceDirs>
92+
</configuration>
93+
</execution>
94+
<execution>
95+
<id>test-compile</id>
96+
<goals>
97+
<goal>test-compile</goal> <!-- You can skip the <goals> element if you enable extensions for the plugin -->
98+
</goals>
99+
<configuration>
100+
<sourceDirs>
101+
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
102+
<sourceDir>${project.basedir}/src/test/java</sourceDir>
103+
</sourceDirs>
104+
</configuration>
105+
</execution>
106+
</executions>
107+
108+
<!-- Enable use Lombok-generated code from Java classes in Kotlin -->
109+
<!-- see https://github.com/kotlin-hands-on/kotlin-lombok-examples/blob/master/kotlin_lombok_maven/nokapt/pom.xml -->
110+
<dependencies>
111+
<dependency>
112+
<groupId>org.jetbrains.kotlin</groupId>
113+
<artifactId>kotlin-maven-lombok</artifactId>
114+
<version>${kotlin.version}</version>
115+
</dependency>
116+
</dependencies>
117+
</plugin>
118+
<plugin>
119+
<groupId>org.apache.maven.plugins</groupId>
120+
<artifactId>maven-compiler-plugin</artifactId>
121+
<version>${maven-compiler-plugin.version}</version>
122+
<executions>
123+
<!-- Replacing default-compile as it is treated specially by Maven -->
124+
<execution>
125+
<id>default-compile</id>
126+
<phase>none</phase>
127+
</execution>
128+
<!-- Replacing default-testCompile as it is treated specially by Maven -->
129+
<execution>
130+
<id>default-testCompile</id>
131+
<phase>none</phase>
132+
</execution>
133+
<execution>
134+
<id>java-compile</id>
135+
<phase>compile</phase>
136+
<goals>
137+
<goal>compile</goal>
138+
</goals>
139+
</execution>
140+
<execution>
141+
<id>java-test-compile</id>
142+
<phase>test-compile</phase>
143+
<goals>
144+
<goal>testCompile</goal>
145+
</goals>
146+
</execution>
147+
</executions>
148+
149+
<!-- MapStruct and Lombok configuration -->
150+
<configuration>
151+
<source>${java.version}</source>
152+
<target>${java.version}</target>
153+
<annotationProcessorPaths>
154+
<path>
155+
<groupId>org.mapstruct</groupId>
156+
<artifactId>mapstruct-processor</artifactId>
157+
<version>${org.mapstruct.version}</version>
158+
</path>
159+
<path>
160+
<groupId>org.projectlombok</groupId>
161+
<artifactId>lombok</artifactId>
162+
<version>${lombok.version}</version>
163+
</path>
164+
165+
<!-- This is needed when using Lombok 1.8.16 and above -->
166+
<!-- see https://mapstruct.org/faq/#can-i-use-mapstruct-together-with-project-lombok -->
167+
<path>
168+
<groupId>org.projectlombok</groupId>
169+
<artifactId>lombok-mapstruct-binding</artifactId>
170+
<version>${lombok-mapstruct-binding.version}</version>
171+
</path>
172+
173+
</annotationProcessorPaths>
174+
</configuration>
175+
176+
</plugin>
177+
178+
<!-- add sources generated by OpenAPI Generator to jar -->
179+
<!-- see http://www.jeeatwork.com/?p=166 -->
180+
<plugin>
181+
<groupId>org.codehaus.mojo</groupId>
182+
<artifactId>build-helper-maven-plugin</artifactId>
183+
<version>${build-helper-maven-plugin.version}</version>
184+
<executions>
185+
<execution>
186+
<id>add-source</id>
187+
<phase>generate-sources</phase>
188+
<goals>
189+
<goal>add-source</goal>
190+
</goals>
191+
<configuration>
192+
<sources>
193+
<source>${project.build.directory}/generated-sources/openapi/src</source>
194+
</sources>
195+
</configuration>
196+
</execution>
197+
</executions>
198+
</plugin>
199+
200+
<plugin>
201+
<groupId>org.assertj</groupId>
202+
<artifactId>assertj-assertions-generator-maven-plugin</artifactId>
203+
<version>${assertj-assertions-generator-maven-plugin.version}</version>
204+
<configuration>
205+
<packages>
206+
<param>ru.klavogonki.statistics.entity</param>
207+
<param>ru.klavogonki.statistics.dto</param>
208+
<param>ru.klavogonki.openapi.model</param>
209+
</packages>
210+
211+
<entryPointClassPackage>ru.klavogonki.statistics</entryPointClassPackage>
212+
<hierarchical>true</hierarchical>
213+
</configuration>
214+
<executions>
215+
<execution>
216+
<goals>
217+
<goal>generate-assertions</goal>
218+
</goals>
219+
<phase>generate-test-resources</phase>
220+
</execution>
221+
</executions>
222+
</plugin>
223+
224+
</plugins>
225+
</build>
226+
227+
</project>

0 commit comments

Comments
 (0)