运行单个 Maven 插件执行? [英] Run a single Maven plugin execution?

查看:50
本文介绍了运行单个 Maven 插件执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以为我是一位经验丰富的 Maven 用户,但我在如何做到这一点上遇到了障碍!

I thought I was an experienced Maven user, but I am having a mental block on how to do this!

我已经能够使用 Maven sql 插件通过我定义并绑定到 pre-integration-test 阶段的插件执行在数据库中删除、创建和安装模式.

I've been able to use the Maven sql plugin to drop, create, and install a schema in a database via plugin executions I've defined and bound to the pre-integration-test phase.

但是,现在我想使用相同的 sql 插件随时从命令行插入一些示例数据——也就是说,不绑定到任何生命周期目标.有几组不同的样本数据,所以我想定义几个不同的执行.

However, now I'd like to use that same sql plugin to insert some sample data whenever I want from the command line -- that is, not bound to any lifecycle goal. There are a few different sets of sample data, so I'd like to define a few different executions.

但是有没有办法通过使用执行 ID 从命令行运行这些执行之一?

But is there a way to run one of these executions from the command line by using the execution ID perhaps?

推荐答案

如何直接从命令行执行maven插件?,这个功能已MNG-5768,并且在Maven 3.3中可用.1.

As noted in How to execute maven plugin execution directly from command line?, this functionality has been implemented as MNG-5768, and is available in Maven 3.3.1.

变化将:

扩展直接插件调用语法以允许可选的@execution-id 参数,例如,org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process@executionId.

extend direct plugin invocation syntax to allow optional @execution-id parameter, e.g., org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process@executionId.

所以,只要你给你的执行一个id:

So, as long as you give your execution an id:

mvn sql:execute@specific-execution-id

使用在你的 pom 中配置的执行.

uses the execution configured in your pom.

这篇关于运行单个 Maven 插件执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆