Closed vladmihalcea closed 1 year ago
When using Kotlin, you need to add the following all-open dependency:
all-open
<dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-maven-allopen</artifactId> <version>${kotlin.version}</version> </dependency>
And add the following configuration to the kotlin-maven-plugin:
kotlin-maven-plugin
<plugin> <artifactId>kotlin-maven-plugin</artifactId> <groupId>org.jetbrains.kotlin</groupId> <version>${kotlin.version}</version> <configuration> <compilerPlugins> ... <plugin>all-open</plugin> </compilerPlugins> <pluginOptions> <option>all-open:annotation=javax.persistence.Entity</option> <option>all-open:annotation=javax.persistence.MappedSuperclass</option> <option>all-open:annotation=javax.persistence.Embeddable</option> </pluginOptions> </configuration> <executions> <execution> <id>compile</id> <goals> <goal>compile</goal> </goals> <configuration> <sourceDirs> <sourceDir>${project.basedir}/src/main/kotlin</sourceDir> <sourceDir>${project.basedir}/src/main/java</sourceDir> </sourceDirs> </configuration> </execution> <execution> <id>test-compile</id> <goals> <goal>test-compile</goal> </goals> <configuration> <sourceDirs> <sourceDir>${project.basedir}/src/test/kotlin</sourceDir> <sourceDir>${project.basedir}/src/test/java</sourceDir> </sourceDirs> </configuration> </execution> </executions> </plugin>
For more details, check out this article.
Fixed.
When using Kotlin, you need to add the following
all-open
dependency:And add the following configuration to the
kotlin-maven-plugin
:For more details, check out this article.