Changes in IntelliJ Community Edition Project Not Reflecting in Terminal Output on ubuntu WSL
I'm experiencing a problem with IntelliJ Community Edition when developing a Java project on WSL2 Ubuntu. My project setup is straightforward, using IntelliJ's build system rather than Maven or Gradle. Initially, when I run the project, everything compiles fine, and the output is displayed in the terminal. However, when I make subsequent changes, like adding a new System.out.println() statement, these changes do not appear in the terminal output unless I perform a manual rebuild.
Here are some specifics about my setup:
- IDE: IntelliJ Community Edition
- Build system: Default IntelliJ build system (not Maven or Gradle)
- Java version on Ubuntu WSL2: OpenJDK 17.0.10
- Project JDK: Java 17
- Relevant IntelliJ Setting: "Build project automatically" is enabled
To isolate the issue, I created a similar project on my local Windows system using Java 21, and it works as expected, with changes being picked up automatically.
Could this be an issue specific to the combination of IntelliJ and WSL2, or is there a setting or step I might be missing to get automatic builds working on Ubuntu under WSL2?
请先登录再写评论。
I found what the problem was. If we create a new project in IntelliJ Community, the path of the project within WSL is
\\wsl.localhost\Ubuntu-22.04\. However, if I create a new project using\\wsl$\Ubuntu-22.04\, then everything compiles with every change I make.IntelliJ Community seems to has some problem with
wsl.localhost.Hello,
Issue should be fixed in 2024.2 release: https://youtrack.jetbrains.com/issue/IDEA-341365