1.概述:
maven管理的project都有一套标准的目录结构,也就是说不关你是什么project,只要你的这个project是使用maven进行管理的,那么你的这个project的所有文件的组织方式都是一样的(都是遵循maven的标准目录结构的)。当然,可能有些项目进行到后期的时候会根据需要更改maven project的标准目录结构(如添加其他必要文件夹...)。
2.maven 所提供的Archetypes
参考资料:maven官网documentation
概述:maven中提供了若干工程模板,也即archetypes,这些project templates是针对不同类型的工程抽象出来的,特定类型的project拥有特定的标准目录结构,可以使用maven直接建立拥有相应类型project标准目录结构的你的工程,加快项目的build speed.
Provided Archetypes:Maven provides several Archetype artifacts,如下表
Archetype ArtifactIds | Description |
---|---|
maven-archetype-archetype | An archetype to generate a sample archetype. |
maven-archetype-j2ee-simple | An archetype to generate a simplifed sample J2EE application. |
maven-archetype-mojo (deprecated) | Deprecated in favour of maven-archetype-plugin, which has a better name. |
maven-archetype-plugin | An archetype to generate a sample Maven plugin. |
maven-archetype-plugin-site | An archetype to generate a sample Maven plugin site. |
maven-archetype-portlet | An archetype to generate a sample JSR-268 Portlet. |
maven-archetype-quickstart | An archetype to generate a sample Maven project. |
maven-archetype-simple | An archetype to generate a simple Maven project. |
maven-archetype-site | An archetype to generate a sample Maven site which demonstrates some of the supported document types like APT, XDoc, and FML and demonstrates how to i18n your site. |
maven-archetype-site-simple | An archetype to generate a sample Maven site. |
maven-archetype-webapp | An archetype to generate a sample Maven Webapp project. |
For more information on these archetypes, please refer to the Maven Archetype Bundles page.
If you would like to know how to make your own archetypes, please refer to our Guide to creating archetypes.
3.maven project的标准目录结构
参考资料:maven官网documentation
标准目录结构:
src/main/java | Application/Library sources |
src/main/resources | Application/Library resources |
src/main/resources-filtered | Application/Library resources which are filtered. (Starting with Maven 3.4.0, not yet released.) |
src/main/filters | Resource filter files |
src/main/webapp | Web application sources |
src/test/java | Test sources |
src/test/resources | Test resources |
src/test/resources-filtered | Test resources which are filtered by default. (Starting with Maven 3.4.0, not yet released.) |
src/test/filters | Test resource filter files |
src/it | Integration Tests (primarily for plugins) |
src/assembly | Assembly descriptors |
src/site | Site |
LICENSE.txt | Project's license |
NOTICE.txt | Notices and attributions required by libraries that the project depends on |
README.txt | Project's readme |
The target directory is used to house all output of the build.