Maven目录结构 [英] Maven directory structure
问题描述
我是Maven的新手,并且我一直在阅读所有早上的教程(令人惊奇的工具).
I'm new to Maven and I've been reading all morning tutorials (amazing tool).
我开始研究的这个新Java项目不使用默认目录结构.代替src/main/java
作为来源,它使用类似src/org/myapp
的东西.
This new Java project I started looking at however doesn't use the default directory structure. Instead of src/main/java
for sources it uses something like src/org/myapp
.
在项目(位于pom.xml
所在的位置)上运行mvn package
时,我收到一条消息,提示未编译任何源,因为找不到源(源路径不同).
When I run mvn package
on the project (where pom.xml
is located) I get a message saying that no Sources have been compiled because it's not able to find them (the source path being different).
是否可以在Maven中指定您自己的源路径?
Is there a way to specify your own sources path in Maven?
推荐答案
将sourceDirectory
添加到pom文件中的build
标记中.
Add sourceDirectory
to the build
tag in the pom file.
<build>
...
<sourceDirectory>src</sourceDirectory>
...
</build>
此处是maven文档中的相关部分.
Here is the relevant section in the maven docs.
这篇关于Maven目录结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!