maven2(Java / Hippo)中不同的cargo.run配置文件
我正在尝试为使用 Java / JCR CMS Hippo 的项目设置构建/部署流程。我们想要实现的部署策略是:
本地开发:使用 Hippo 提供的默认“内存”数据库。
测试和生产环境:使用MySQL。
我已成功按照 将 Hippo 设置为使用 MySQL,现在我正在尝试配置 maven2 pom.xml,以便我们可以进行不同的部署 - 一种由开发人员从 IDE/命令行调用,另一种由 Jenkins 调用。因此,我阅读了 Hippo 使用的 Cargo maven2 插件,并尝试创建一个名为 Cargo.run.mysql 的新配置文件 - 但是,当我使用 mvn -P Cargo.run.mysql 运行 Maven 时,Cargo 不会启动容器( Tomcat),它改为构建。在对 Cargo 插件页面进行了更多阅读之后,我猜测(可能是错误的!)Maven 配置文件 ID 和 Cargo '目标'/'执行模式' 之间存在某种神奇的链接(在本例中为 Cargo.run) -> 货物:运行)。所以现在我一直试图让我的新目标运行不同的配置文件复制任务。
有人有这方面的经验吗?也非常欢迎有关如何明智地做到这一点的建议!我习惯了使用 ant 及其更底层的方法,而且我不得不承认 Maven 确实让我摸不着头脑。
I'm trying to setup our build/deploy process for a project that uses Hippo, a Java / JCR CMS. The deployment strategy we want to achieve is:
Local development: use the default 'in memory' database provided with Hippo.
Test and production environments: use MySQL.
I've successfully followed the instructions for setting Hippo up to use MySQL and now I'm trying to configure the maven2 pom.xml so we can have different deployments - one called from the IDE/command line by a developer and one called by Jenkins. So I read up on the cargo maven2 plugin used by Hippo, and tried to create a new profile called cargo.run.mysql - however, when I run maven with mvn -P cargo.run.mysql, cargo does not start the container (Tomcat), it builds instead. After some more reading on the cargo plugin page, I'm guessing (could be wrong!) that there's some kind of magic link between a maven profile ID and a cargo 'target' / 'execution mode' (in this case cargo.run -> cargo:run). So now I'm stuck trying to get my new target with its different configuration file copy tasks to run.
Does anyone have experience with this? Advice on how to do this sensibly is also very welcome! I'm used to using ant and its more low-level approach, and I have to admit maven is really making me scratch my head a lot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能会忽略的神奇部分是,配置文件在 pom.xml 层次结构中定义了多次。您可能会丢失的部分一直在 hippo-cms7-project pom 中。
看
http://svn .onehippo.org/repos/hippo/hippo-cms7/project/tags/hippo-cms7-project-8/pom.xml
我是否正确理解您正在尝试运行你的项目来自 Jenkins?您是否注意到您还可以使用 maven -Pdist 配置文件创建发行版?这样,它将从您的项目创建一个发行版,您可以将其部署到远程服务器。
The magic part that you might be missing is that the profile is defined multiple times in the pom.xml hierarchy. The part that you might be missing is all the way up in the hippo-cms7-project pom.
See
http://svn.onehippo.org/repos/hippo/hippo-cms7/project/tags/hippo-cms7-project-8/pom.xml
Do I understand it correctly that you are trying to run your project from Jenkins? Have you noticed that you could also create a distribution by using the maven -Pdist profile? That way it will create a distribution from your project that you might deploy to a remote server.