简体   繁体   English

无法从 Windows IntelliJ 在 WSL2 中编译 Maven 项目

[英]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.

相关问题 我无法使用 WSL2 中的 git 在 Windows 上签署来自 IntellIJ 的提交 - I can't sign commits from IntellIJ on windows using git from WSL2 无法再从 Windows 资源管理器访问 WSL2 文件或从 WSL2 启动 Windows 程序 - Can no longer access WSL2 files from Windows explorer or launch Windows programs from WSL2 我无法从 PhpStorm 保存到 WSL2 - I can not save from PhpStorm to WSL2 Windows10 WSL2 “gpg:无法连接到代理:IPC 连接调用失败” - Windows10 WSL2 “gpg: can't connect to the agent: IPC connect call failed” 在 Windows 终端 WSL2 中找不到我的发行版或 ubuntu 用户 - Can't find my distro or ubuntu user in Windows terminal WSL2 无法从 Windows 主机连接到 WSL2 上的本地服务器 - Unable to connect to local server on WSL2 from Windows host 如何使wsl2在Windows 10上从停止状态变为运行状态 - How to make wsl2 from stopped to running on Windows 10 WSL2 - Linux 相对符号链接在仅针对 \\\\wsl$\\ 挂载点从 Windows 访问时损坏 - WSL2 - Linux relative symlinks broken when accessed from windows only for the \\wsl$\ mount-point 添加 JDK 路径从 WSL2 Ubuntu 到 IntelliJ IDE 冻结屏幕 - Adding JDK path from WSL2 Ubuntu to IntelliJ IDE frozen the screen 将 WSL2 命令添加到 Windows Powershell - Adding WSL2 commands to Windows Powershell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM