Created
December 11, 2024 15:10
-
-
Save soudmaijer/70b6bff689ebf57b8b4c6a0d62d40f67 to your computer and use it in GitHub Desktop.
Example kotlin + openapi generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.sourcelabs</groupId> | |
<artifactId>backoffice-tool</artifactId> | |
<version>0.0.1</version> | |
<packaging>jar</packaging> | |
<name>backoffice-tool</name> | |
<description>Spring Boot Kotlin Application</description> | |
<properties> | |
<java.version>21</java.version> | |
<kotlin.version>2.0.20</kotlin.version> | |
<spring-boot.version>3.2.0</spring-boot.version> | |
<testcontainers.version>1.20.2</testcontainers.version> | |
<openapi.version>2.6.0</openapi.version> | |
</properties> | |
<parent> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-parent</artifactId> | |
<version>3.2.0</version> | |
<relativePath/> | |
</parent> | |
<dependencies> | |
<!-- Spring Boot Starters --> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-web</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-security</artifactId> | |
</dependency> | |
<!-- Spring Boot Starter for Data JDBC --> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-data-jdbc</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-actuator</artifactId> | |
</dependency> | |
<!-- Spring Boot Test for JUnit --> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-test</artifactId> | |
<scope>test</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-devtools</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-oauth2-client</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId> | |
</dependency> | |
<!-- Liquibase--> | |
<dependency> | |
<groupId>org.liquibase</groupId> | |
<artifactId>liquibase-core</artifactId> | |
</dependency> | |
<!-- PostgreSQL Driver --> | |
<dependency> | |
<groupId>org.postgresql</groupId> | |
<artifactId>postgresql</artifactId> | |
</dependency> | |
<!-- Testcontainers for testing --> | |
<dependency> | |
<groupId>org.testcontainers</groupId> | |
<artifactId>testcontainers</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.testcontainers</groupId> | |
<artifactId>postgresql</artifactId> | |
</dependency> | |
<!-- Kotlin Dependencies --> | |
<dependency> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<artifactId>kotlin-reflect</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<artifactId>kotlin-stdlib-jdk8</artifactId> | |
</dependency> | |
<!-- Springdoc Dependencies --> | |
<dependency> | |
<groupId>org.springdoc</groupId> | |
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> | |
<version>${openapi.version}</version> | |
</dependency> | |
<!-- Jakarta Dependencies --> | |
<dependency> | |
<groupId>jakarta.xml.bind</groupId> | |
<artifactId>jakarta.xml.bind-api</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>jakarta.validation</groupId> | |
<artifactId>jakarta.validation-api</artifactId> | |
</dependency> | |
<!-- JUnit Jupiter (JUnit 5) for running tests --> | |
<dependency> | |
<groupId>org.junit.jupiter</groupId> | |
<artifactId>junit-jupiter-engine</artifactId> | |
<scope>test</scope> | |
</dependency> | |
<dependency> | |
<groupId>com.fasterxml.jackson.core</groupId> | |
<artifactId>jackson-databind</artifactId> | |
</dependency> | |
<!-- Jackson module for LocalDate --> | |
<dependency> | |
<groupId>com.fasterxml.jackson.datatype</groupId> | |
<artifactId>jackson-datatype-jsr310</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>org.springframework.security</groupId> | |
<artifactId>spring-security-test</artifactId> | |
<scope>test</scope> | |
</dependency> | |
<dependency> | |
<groupId>io.mockk</groupId> | |
<artifactId>mockk-jvm</artifactId> | |
<version>1.13.2</version> | |
<scope>test</scope> | |
</dependency> | |
<dependency> | |
<groupId>com.ninja-squad</groupId> | |
<artifactId>springmockk</artifactId> | |
<version>4.0.2</version> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> | |
<build> | |
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory> | |
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory> | |
<resources> | |
<resource> | |
<directory>${project.basedir}/src/main/resources</directory> | |
</resource> | |
</resources> | |
<plugins> | |
<!-- Kotlin Maven Plugin --> | |
<plugin> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<artifactId>kotlin-maven-plugin</artifactId> | |
<configuration> | |
<compilerPlugins> | |
<plugin>spring</plugin> | |
<plugin>no-arg</plugin> | |
</compilerPlugins> | |
</configuration> | |
<dependencies> | |
<dependency> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<artifactId>kotlin-maven-allopen</artifactId> | |
<version>${kotlin.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<artifactId>kotlin-maven-noarg</artifactId> | |
<version>${kotlin.version}</version> | |
</dependency> | |
</dependencies> | |
</plugin> | |
<!-- Spring Boot Maven Plugin --> | |
<plugin> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-maven-plugin</artifactId> | |
</plugin> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<configuration> | |
<source>21</source> | |
<target>21</target> | |
</configuration> | |
</plugin> | |
<!-- OpenAPI Generator --> | |
<plugin> | |
<groupId>org.openapitools</groupId> | |
<artifactId>openapi-generator-maven-plugin</artifactId> | |
<version>7.9.0</version> | |
<executions> | |
<execution> | |
<goals> | |
<goal>generate</goal> | |
</goals> | |
<configuration> | |
<inputSpec>${project.basedir}/src/main/resources/openapi/master-openapi.yml</inputSpec> | |
<generatorName>kotlin-spring</generatorName> | |
<output>${project.build.directory}/generated-sources/openapi</output> | |
<apiPackage>com.sourcelabs.backofficetool.api</apiPackage> | |
<modelPackage>com.sourcelabs.backofficetool.model</modelPackage> | |
<supportingFilesToGenerate>false</supportingFilesToGenerate> | |
<configOptions> | |
<documentationProvider>springdoc</documentationProvider> | |
<beanQualifiers>true</beanQualifiers> | |
<interfaceOnly>true</interfaceOnly> | |
<swaggerAnnotations>true</swaggerAnnotations> | |
<useSpringBoot3>true</useSpringBoot3> | |
<sourceFolder>/</sourceFolder> | |
<useBeanValidation>true</useBeanValidation> | |
<skipDefaultInterface>true</skipDefaultInterface> | |
<useTags>true</useTags> | |
</configOptions> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<plugin> | |
<groupId>org.codehaus.mojo</groupId> | |
<artifactId>build-helper-maven-plugin</artifactId> | |
<executions> | |
<execution> | |
<id>add-source</id> | |
<phase>generate-sources</phase> | |
<goals> | |
<goal>add-source</goal> | |
</goals> | |
<configuration> | |
<sources> | |
<source>target/generated-sources/openapi</source> | |
</sources> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
<repositories> | |
<repository> | |
<id>spring-releases</id> | |
<url>https://repo.spring.io/release</url> | |
</repository> | |
</repositories> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment