英文:
IntellijIDE Marking top directory as sources root causes src.main.java.com.mycompany.xyz
问题
通常情况下,当我标记以 main/java/src 结构组织的Maven项目的顶级目录时,它会找到正确的包 com.mycompany.xyz。但在一个项目中,我注意到它错误地将包的开头解释为 main.java.src.com.mycompany.xyz。正确的源根目录是什么,为什么会有这种差异?
英文:
Normally when I mark top level directory of maven project that is structured as main/java/src it finds the correct package com.mycompany.xyz but on one project I notice it interprets the start of the package incorrectly as main.java.src.com.mycompany.xyz what is the correct root directory to use as source and why the difference?
答案1
得分: 2
src/main/java 是 Maven 项目的正确源代码目录。请参阅标准目录布局介绍。
IntelliJ IDEA 应该会自动从 pom.xml 中导入它。请确保不要在构建文件中覆盖它,像这样。
英文:
src/main/java is the correct source directory for the Maven projects. See Introduction to the Standard Directory Layout.
IntelliJ IDEA should import it automatically from the pom.xml. Make sure you don't override it anywhere in the build file like this.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论