windows - 无法从 Windows IntelliJ 在 WSL2 中编译 Maven 项目
问题描述
我正在尝试将 IntelliJ 与 WSL2 一起使用,但我遇到了问题。我用一个简单的主类打印 hello world 创建了一个虚拟项目。我将项目放在我的 WSL 文件系统中。当我尝试使用 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.
为什么会这样?我可以使用sudo apt get install maven
从 WSL2 Ubuntu 终端下载的 maven 构建项目。
解决方案
这可能是因为您的项目位于 Windows 文件系统中。为了解决这个问题,当您创建或打开一个项目时,请确保它的位置位于 wsl 目录中(例如 -> \wsl$\Ubuntu\home\andre\IdeaProjectsInWSL\MyProject)。
推荐阅读
- python - 当主窗口移出屏幕时,小部件消失
- amazon-web-services - AWS EB + nginx:更新 access.log 格式以混淆敏感的获取请求参数
- python-3.x - 与协程的两种方式通信(asyncio 中的状态机)
- javascript - Ajax 在页面中发回后,Javascript 控制台命令不起作用
- ios - 滚动视图与集合视图。获取“可见图像”
- scala - 具有数组和映射数据类型的 Spark Scala 案例类
- javascript - Chrome 中的文件和目录条目 API 是否损坏?
- javascript - Lightbox2 突然无法在 Chrome 中运行
- python - google.cloud 在哪个 python 库中?
- python - 如何使用 pytest 模拟导入的模块