[英]Can't compile Maven project in WSL2 from Windows IntelliJ
I am trying to use IntelliJ with WSL2 but I'm experiencing problems.我正在尝试将 IntelliJ 与 WSL2 一起使用,但我遇到了问题。 I created a dummy project with a simple main class printing hello world.我创建了一个虚拟项目,其中包含一个简单的 main class 打印 hello world。 I placed the project in my WSL file system.我将项目放在我的 WSL 文件系统中。 When I try to run/build with IntelliJ, I get this message:当我尝试使用 IntelliJ 运行/构建时,我收到以下消息:
Maven resources compiler: Maven project configuration required for module 'testproject' isn't available. Compilation of Maven projects is supported only if external build is started from an IDE.
Why is this happening?为什么会这样? I can build the project just fine using maven downloaded with sudo apt get install maven
from a WSL2 Ubuntu terminal.我可以使用从 WSL2 Ubuntu 终端通过sudo apt get install maven
下载的 maven 构建项目。
Probably this is because your project is located in your windows file system.这可能是因为您的项目位于 windows 文件系统中。 To solve it, when you create or open a project make sure that the location of this is in a wsl directory (for example -> \wsl$\Ubuntu\home\andre\IdeaProjectsInWSL\MyProject).为了解决这个问题,当您创建或打开一个项目时,请确保它的位置位于 wsl 目录中(例如 -> \wsl$\Ubuntu\home\andre\IdeaProjectsInWSL\MyProject)。
https://www.jetbrains.com/help/idea/how-to-use-wsl-development-environment-in-product.html#crete_project_for_wsl https://www.jetbrains.com/help/idea/how-to-use-wsl-development-environment-in-product.html#crete_project_for_wsl
I was facing the same issue, IntelliJ installed on windows has issue with opening and working with wsl files.我遇到了同样的问题,安装在 windows 上的 IntelliJ 在打开和使用 wsl 文件时出现问题。
I have installed linux varient intellij on wsl distro itself.我已经在 wsl 发行版本身上安装了 linux varient intellij。 latest wsl supports GUI apps.最新的 wsl 支持 GUI 应用程序。 Its good enough for me.对我来说已经足够好了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.