Maven目录结构 [英] Maven directory structure

查看:105
本文介绍了Maven目录结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆