找不到插件:jpa

Jer*_*rry 4 spring jpa maven kotlin spring-boot

<plugin>
    <artifactId>kotlin-maven-plugin</artifactId>
    <groupId>org.jetbrains.kotlin</groupId>
    <configuration>
        <args>
            <arg>-Xjsr305=strict</arg>
        </args>
        <compilerPlugins>
            <plugin>spring</plugin>
            <plugin>jpa</plugin>
        </compilerPlugins>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-maven-allopen</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
    </dependencies>
</plugin>
Run Code Online (Sandbox Code Playgroud)

当我运行时mvn compile,控制台中的结果将显示错误:

找不到插件:jpa:java.util.NoSuchElementException

我已经检查了参考, 但仍然无法弄清楚。有人遇到过吗?

Jer*_*rry 5

将以下依赖项添加到您的<dependecies>元素中:

<dependency>
    <groupId>org.jetbrains.kotlin</groupId>
    <artifactId>kotlin-maven-noarg</artifactId>
    <version>${kotlin.version}</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

  • 对于来自 Google 的用户,请确保它是 `&lt;build&gt;&lt;plugins&gt;&lt;plugin&gt;` (kotlin-maven-plugin) `&lt;dependency&gt; &lt;dependency&gt;...` 而不是任何其他地方 (2认同)

Jer*_*rry -2

通过添加以下行解决:

                <compilerPlugins>
                    <plugin>all-open</plugin>
                    <plugin>spring</plugin>
                    <plugin>no-arg</plugin>
                    <plugin>jpa</plugin>
                </compilerPlugins>
Run Code Online (Sandbox Code Playgroud)

jpa 插件也需要 no-arg 插件存在