Reputation: 725
We have inherited a SpringBoot project written in Kotlin. Using Intellij, I would expect to be able to go to the Application main method and click the green arrow to start the project. I would also expect to be able to run the project in debug mode and set breakpoints, this only works with tests.
When I try and run the project I get a exception FileNotFound
which has yielded me no answers. Every file appears to be accounted for and there is clearly nothing missing.
This is a multi-module gradle project with many unique configurations and I suspect one is causing an issue. I am having trouble determining which configuration is causing the issue because the project doesn't even seem to get to the point of standing up Spring (no banner).
I have tried many different combinations of bash scripts, environment variables, and gradle tasks and the project does not seem to run at all. Is there any way I can use Intellij to debug the sequence of configurations and gradle tasks?
Upvotes: 1
Views: 576
Reputation: 725
So, I am answering my own question because searches lead me nowhere and this was a surprisingly difficult problem to debug. It turns out I was taking the wrong approaches and asking the wrong questions. I took a lot of time to study up on Spring configurations and Gradle tasks to realize none of our stuff was wrong. The Kotlin compiler was failing at the very beginning.
What had happened was one developer naively cd
'ed into the Application's module and ran an echo
statement that piped gradle output to a file called out
with no extensions.
Kotlin would find this file and then proceed to not compile anything starting at the Application main. When we ran the app from terminal the app would recompile itself from the very beginning with no problems. But the automatically generated Intellij config simply ran the app with the bad file every time.
The troubling part was that our .gitignore
file was configured to ignore all of the kotlin /out/
directories, but not files like /out
so this troublesome file was committed to the repository for quite a while.
Surprisingly, deleting this out
file fixed most of the issues our project had with Intellij.
Another note:
Our script was also set to source
certain variables from other scripts, which meant we either had to carry them over to the runtime configs. We could also run Intelli from the same terminal we had already sourc
ed the script in (using Tools> Create command line launcher). Once I had that sorted the project ran and debugged perfectly.
Upvotes: 2