Search code examples
mavenkotlinintellij-idea

Dependency 'org.jetbrains.kotlin:kotlin-maven-noarg:1.4.31' not found in IntelliJ with Maven


enter image description here

I added kotlin-maven-noarg dependency in kotlin-maven-plugin but IntelliJ generates Dependency 'org.jetbrains.kotlin:kotlin-maven-noarg:1.4.31' not found error.

It's really weird. The repository, https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-maven-noarg/1.4.31 exist but maven failed to find it. Could you tell me how to fix it?

            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>kapt</id>
                        <goals>
                            <goal>kapt</goal>
                        </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>src/main/kotlin</sourceDir>
                                <sourceDir>src/main/java</sourceDir>
                            </sourceDirs>
                            <annotationProcessorPaths>
<!--                                <annotationProcessorPath>
                                    <groupId>org.projectlombok</groupId>
                                    <artifactId>lombok</artifactId>
                                    <version>${org.projectlombok.version}</version>
                                </annotationProcessorPath>-->
                                <annotationProcessorPath>
                                    <groupId>org.mapstruct</groupId>
                                    <artifactId>mapstruct-processor</artifactId>
                                    <version>${org.mapstruct.version}</version>
                                </annotationProcessorPath>
                            </annotationProcessorPaths>
                        </configuration>
                    </execution>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <args>
                        <arg>-Xjsr305=strict</arg>
                    </args>
                    <compilerPlugins>
                        <plugin>spring</plugin>
                        <plugin>jpa</plugin>
                        <plugin>no-arg</plugin>
                    </compilerPlugins>
                    <!--<jvmTarget>1.8</jvmTarget>-->
                </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>
``


  [1]: https://i.sstatic.net/X3JVe.png

Solution

  • enter image description here

    Mouse right button > Maven > Generate Sources and Update Folders fixed the issue. I'm not sure why I have to do it manually.