✨Maven约定优于配置

Maven can provide benefits for your build process by employing standard conventions and practices to accelerate your development cycle while at the same time helping you achieve a higher rate of success.

Maven可以通过采用标准约定和实践来加快构建周期,同时为您提供更高的成功率,从而为您的构建过程带来好处。

来自 Maven官方文档


POM简介

项目对象模型或POM是Maven中的基本工作单元。这是一个XML文件,其中包含有关项目的信息以及Maven用于构建项目的配置详细信息。它包含大多数项目的默认值。这样的示例是build目录,即target; 源目录,即src/main/java;测试源目录,即src/test/java;等等。执行任务或目标时,Maven在当前目录中查找POM。它读取POM,获取所需的配置信息,然后执行目标。

可以在POM中指定的一些配置是项目依赖项,可以执行的插件或目标,构建配置文件等等。也可以指定其他信息,例如项目版本,描述,开发人员,邮件列表等。


Maven标准目录布局


✨资源导出失败 解决方案

在build中配置resources

<!--    Maven配置pom.xml 防止资源导出失败-->
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

✨参考及引用

https://maven.apache.org/guides/getting-started/index.html

http://maven.apache.org/guides/introduction/introduction-to-the-pom.html

https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html

https://www.cnblogs.com/yuqiliu/p/12059614.html


⭐转载请注明出处

本文作者:双份浓缩馥芮白

原文链接:https://www.cnblogs.com/Flat-White/p/14741845.html

版权所有,如需转载请注明出处。

内容来源于网络如有侵权请私信删除

文章来源: 博客园

原文链接: https://www.cnblogs.com/Flat-White/p/14741845.html

你还没有登录,请先登录注册
  • 还没有人评论,欢迎说说您的想法!

相关课程