在maven中处理Web项目的非常规源目录

时间:2022-12-19 15:59:00

I've inherited a web project (Servlets) which is currently build inside eclipse.

我继承了一个目前在eclipse中构建的web项目(Servlets)。

I want to add maven around it. But the project's source directory is not following the maven convention. Instead of being inside src/main/java, it's src/package/name/...

我想在它周围添加maven。但该项目的源目录不遵循maven约定。它不是在src / main / java里面,而是src / package / name / ...

I don't want to change anything right now because they are working at full speed towards a milestone. Can I configure maven to accept src/ as the java source directory ? Thanks

我现在不想改变任何事情,因为他们正在全力以赴地迈向里程碑。我可以配置maven接受src /作为java源目录吗?谢谢

1 个解决方案

#1


32  

Just add this to your pom in the build section.

只需在构建部分将其添加到您的pom中即可。

<sourceDirectory>${basedir}/src</sourceDirectory>

Here's the relevant section of the POM doc on configuring the directories.

以下是配置目录的POM文档的相关部分。

#1


32  

Just add this to your pom in the build section.

只需在构建部分将其添加到您的pom中即可。

<sourceDirectory>${basedir}/src</sourceDirectory>

Here's the relevant section of the POM doc on configuring the directories.

以下是配置目录的POM文档的相关部分。