maven 构建项目时 java路径下配置属性文件相关

来源:互联网 发布:金隅悦城丽悦园网络 编辑:程序博客网 时间:2024/06/10 07:25
问题:maven项目 属性文件默认放在src/main/resources路径下;当将属性文件 或配置文件放置在java路径下时(mybatis 配置mapping文件等)的问题
问题原因:maven在构建过程中java路径下的属性以及配置文件不会被构建(Maven会按照标准的目录结构查找和处理各种类型文件
解决方案:通过相关插件促使maven对java下的属性及配置文件进行构建
插件1
<plugin>    <groupId>org.codehaus.mojo</groupId>    <artifactId>build-helper-maven-plugin</artifactId>    <version>1.8</version>    <executions>        <execution>            <id>add-resource</id>            <phase>generate-resources</phase>            <goals>                <goal>add-resource</goal>            </goals>            <configuration>                <resources>                    <resource>                        <directory>src/main/java</directory>                        <includes>                            <include>**/*.xml</include>                        </includes>                    </resource>                </resources>            </configuration>        </execution>    </executions></plugin>
 
原创粉丝点击