使用IntelliJ IDEA运行Maven项目 [英] Run a Maven Project using IntelliJ IDEA
问题描述
我是IntelliJ IDEA的新手,我想使用它运行一个简单的Maven Quickstart项目。
我按照所有说明操作,项目成功完成。但是当我尝试编译并运行它时,运行
按钮未激活。
它看起来像IntelliJ IDEA无法确定主要课程的位置。
这是项目层次结构的图片。
问题是什么?我该如何解决?
谢谢!
刷新 Maven项目工具窗口中的Maven项目(重新导入所有Maven项目),如果没有帮助,请参阅
问题是由于某种原因你的源根未在Maven模型中正确配置而且 .java
文件出现在普通目录而不是源根。
您可以通过文件夹的颜色和文件的图标来判断。
I'm new to IntelliJ IDEA and I would like to run a simple Maven Quickstart project using it.
I followed all the instructions, the project was sucessfully built. But when I try to compile and run it , the Run
button is not activated.
It looks like IntelliJ IDEA couldn't figure out where the main class is.
This is a picture of the project's hierarchy.
What is the problem ? And how can I fix it ?
Thanks !
Refresh the Maven project in the Maven Projects tool window (Reimport All Maven Projects), if it doesn't help, refer to this answer for diagnostics.
The issue is that your source roots were not configured correctly from the Maven model for some reason and the .java
file appears in a plain directory instead of the Source root.
You can tell that by the color of the folders and by the icon of the file.
这篇关于使用IntelliJ IDEA运行Maven项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!