我是Maven的新手,想通过自动将几个文件和文件夹部署到生产环境来自动化一些构建步骤:
my-app-0.7.0-jar-with-dependencies.jar (main application file)
conf.properties (configuration file that can be edited on the fly)
files_folder (folder that contains html, css etc. that can be edited on the fly)
我的项目结构如下所示:
src
main
java
resources (contains resources that should be included in the .jar)
conf.properties.jar
files_folder
。
我首先<resources>
在pom.xml
<resources>
<resource>
<directory>.</directory>
<includes>
<include>conf.properties</include>
<include>files_folder/**/*.*</include>
</includes>
<targetPath>..</targetPath>
</resource>
</resources>
这个动作conf.properties
并files_folder
到target
目录,这是好的(我可以复制的.jar,conf.properties和files_folder并运行它们)。
但是,这些文件不会移动到本地存储库中C:\Users\my_name\.m2\...
或外部存储库中(在安装和部署阶段)。
我的想法是,应将这些资源移至存储库,因为:
因此,主要问题是:
Maven是构建工具,而不是部署工具。对于部署到诸如Test,Q&A或Prod之类的环境,其他工具更适合诸如Chef,Puppet,或者可能只是简单的shell脚本等。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句