IntelliJ IDE 将顶层目录标记为源代码根目录会导致 src.main.java.com.mycompany.xyz。

huangapple go评论76阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年8月19日 04:16:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/63476025.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定