Classpath entry points to a non-existent location warning when compiling with Maven

We recently upgraded from Kotlin 1.1.51 to 1.2.10, cleared all the warnings (we use -Werror to treat warnings as errors), and the project is up and running. We build it from command line using mvn verify without issues, as well as from IntelliJ using Build > Build project.

Then, we decided to upgrade to the latest version (1.2.21), and here is where we are seeing some issues: when compiling the project from command line (mvn verify) a warning shows up causing the compilation to fail:

[WARNING] Classpath entry points to a non-existent location: /Users/username/git/projectname/target/classes

The interesting thing is that if we do Build > Build Project on IntelliJ, then there is no warning, and the project will compile (and run) without issues. And if we downgrade Kotlin’s version to 1.2.10 on the pom file (instead of 1.2.21), it builds successfully again from both command line and IntelliJ Build.

We noticed that when we do Build > Build Project, two directories are created in the target folder: classes and test-classes; while when the command line build fails, there are two different directories: kotlin-ic and maven-status.

Why is that difference between command line and IntelliJ build? What causes that warning, and how can we fix it?

3 Likes

I’m facing the same issue when upgrading kotlin from 1.2.10 to 1.2.21.
When compiling project with maven you can see following exception:
[WARNING] Classpath entry points to a non-existent location: /Users/dev/workspace/project/parentPomModule/pomModule/jarModule/target/classes

jarModule is the only module with mix kotlin/java files. Other modules contain only java files.
mvn version used: Apache Maven 3.2.2

2 Likes

It is fixed by disabling kotlin incremental compiler

<kotlin.compiler.incremental>false</kotlin.compiler.incremental>

2 Likes

Thanks for your reply! This worked! Any clue on why it happens with 1.2.21 and not 1.2.10?