IDEA Run Config building classpath before Maven Before Launch task?

Answered

I'm trying to determine if this is an IDEA bug or not. It seems like IDEA is building its classpath before the execution of my before launch operations, causing the run to fail the first time.

I have a Run Config for my Spring Boot app, which has its Working Directory set to "target", the Maven output directory of the project. The Run Config editor dialog rightfully warns that "target" does not exist, in a clean Maven project. In the Before Launch tasks, I have only a Run Maven Goal entry for the "compile" goal, which will build the target directory. No Build, Build Project, etc tasks.

The first time the Run Config is launched after a clean, the Maven compile goal is run, and the target directory is built properly. However, the actual application launch immediately afterwards says that my main class cannot be found. Looking at the launch command line that IDEA built, IDEA did not include the target/classes directory in the classpath. Subsequent launches of the Run Config are fine, since at that point target/classes already exists, and the Before Launch Maven compile is just incrementally updating classes.

If I include a Build entry after the Run Maven Goal entry in my Before Launch tasks, everything is fine and the proper classpath is built during a clean build Run/Debug.

I am running IDEA 2018.1 Ultimate.

0
3 comments

Hello,

Issue is not related to the working directory. I reported an issue on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-190531. Please follow it.

 

0
Avatar
Permanently deleted user

Thanks Yaroslav!

0

You are welcome!

0

Please sign in to leave a comment.