Jerry
Jerry

Reputation: 473

Plugin not found: jpa

<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>

when I run mvn compile, the result in the console prints an error:

Plugin not found: jpa: java.util.NoSuchElementException

I have checked the reference but still cannot figure it out. Did anyone encountered this before?

Upvotes: 12

Views: 5882

Answers (2)

Jerry
Jerry

Reputation: 473

Add the dependency below to your <dependencies> element:

<dependency>
    <groupId>org.jetbrains.kotlin</groupId>
    <artifactId>kotlin-maven-noarg</artifactId>
    <version>${kotlin.version}</version>
</dependency>

See also the official Kotlin documentation

A full plugin configuration would be something like this:

<plugin>
    <groupId>org.jetbrains.kotlin</groupId>
    <artifactId>kotlin-maven-plugin</artifactId>
    <configuration>
        <args>
            <arg>-Xjsr305=strict</arg>
        </args>
        <compilerPlugins>
            <plugin>all-open</plugin>
            <plugin>spring</plugin>
            <plugin>no-arg</plugin>
            <plugin>jpa</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>

Upvotes: 24

Jerry
Jerry

Reputation: 473

solved by add lines below:

                <compilerPlugins>
                    <plugin>all-open</plugin>
                    <plugin>spring</plugin>
                    <plugin>no-arg</plugin>
                    <plugin>jpa</plugin>
                </compilerPlugins>

the jpa plugin also need no-arg plugin exist

Upvotes: -2

Related Questions