0

背景

为了使用使用配置文件自定义 AWS 的 Elastic Beanstalk 的新方法,我需要在.ebextensions文件夹中提供 YAML 配置文件并将其放在 WAR 文件结构的根目录中,然后将其部署到 tomcat。

我真的想避免将配置文件放在源代码存储库中,因为它具有特定于正在部署 Web 应用程序的操作系统的命令。而且我觉得这些配置文件不应该与网络应用程序的源代码耦合。

问题

现在的问题是我需要获取这个配置文件,包括.ebextensions在 maven 创建最终 WAR 文件之前将它们放在根目录中,准备部署。

由于我需要维护将配置文件放在特定文件夹中的目录结构,因此我只能提供一个 zip 文件,然后需要将其解压缩并通过 maven 放入 WAR 文件的根目录中。

我的问题是,有没有办法通过 maven 实现自动化,或者我需要为此采取不同的方法。

4

2 回答 2

2

这对我有帮助:http ://www.jcabi.com/jcabi-beanstalk-maven-plugin/example-ebextensions.html

您也可以试试这个:如何使用 SBT 在 WAR 文件的根目录中打包一个隐藏文件夹?

于 2014-01-05T09:44:28.797 回答
0

我最终编写了一个在构建作业运行之前执行的 shell 脚本。如下,

# This set of of commands will fetch the EC2 customization commands from S3 & package it inside the WAR file which will be then deployed to the server.
pwd
ls -la
# Create "temp" directory to put the fetched configs in to.
mkdir -p temp
ls -la temp/
rm -rf temp/*
cd temp
# Fetch the configs
s3cmd sync -vrf s3://tanzchantz.cdn/resources/configuration/ebs/customize-webapps-container/ .
tree -afphug .
# Copy the configs in to webapp directory
cp -rv . ../webapps-main/src/main/webapp/
cd ..
ls -la webapps-main/src/main/webapp/
于 2014-01-06T19:59:08.603 回答