Maven Project in WSL Not working

已回答

Opening a Maven project from WSL in IntelliJ does not work properly.
IntelliJ does recognize a Maven project, but several bits are missing.

The project is opened from the WSL path \\wsl.localhost\openSUSE-Leap-15.4\home\svmoe

WSL: OpenSUSE Leap 15.6
WSL Version 2
Windows 11

Right after opening the project I am presented with
Maven 'java-application' build scripts found
Button *Load Maven Project". Clicking on it does not help at all.

In Project Structure I can see that is is using a WSL JDK.
Sources are not configured properly.
Libraries are empty.

I have to manually set up Sources right
src/main/java
src/main/resources
src/test/java
src/test/resources

But the maven project still does not work because libraries are empty.
From the Maven Tools view it is missing Plugins and Dependencies listing.

“Sync All maven projects” works, but does nothing.
“Reload All maven projects” fails: An operation is not implemented.

I have configured IntelliJ to use Maven wrapper as Maven home path.

If I change IntelliJ to delegate to Maven for building, then it works building from IntelliJ, but it does much more than just compile like IntelliJ Build project just does.
Development is still not possible, because I have no libraries/dependencies in the project.
Setting Maven home path to a Maven binary on WSL does not help either.

Any suggestion how I can get IntelliJ to work with projects stored on WSL?

0

Hello,

The root of the issue often lies in how IntelliJ (running on Windows) interacts with the WSL filesystem and the Maven/JDK installations within WSL. While IntelliJ has improved its WSL integration, there can still be pathing inconsistencies, permission issues.

Best Regards

0

Hello!

Thank you for reporting this!
Could you please share the IDEA logs for the investigation (Help → Collect Logs and Diagnostic Data)?

You can share them here or via our upload service, in that case please share the Upload ID instead.

 

As a workaround please try the following:

  1. Close all instances of IDEA
  2. Rename or remove the System Directory and the “JetBrains” directory from WSL filesystem found at ~/.cache
  3. Re-import the Project: Open -> Navigate to the Project's directory -> Double-click the root pom.xml -> Open as Project
0

请先登录再写评论。