如何直接从命令行执行 maven 插件执行? [英] How to execute maven plugin execution directly from command line?

查看:81
本文介绍了如何直接从命令行执行 maven 插件执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个配置了执行的插件 (antrun),它有一个 id 并且没有绑定到任何阶段.我可以直接从命令行执行这个执行吗?

I have a plugin (antrun) with an execution configured which has an id and is not bound to any phase. Can I execute this execution directly from the command line?

<plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  <executions>
    <execution>
      <id>my-execution</id>
      ...
    </execution>
  </executions>
</plugin>

使用以下内容运行它:

mvn my-execution

或至少

mvn magicplugin:execute -DexecutionId=my-execution

推荐答案

此功能已 asimplemented.href="655527cdbf12639noreferrer">MNG-5768,在 Maven 3.3.1 中可用.

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.

所以,就你而言:

mvn antrun:run

使用 default-cli 执行 ID,并且:

uses the default-cli execution ID, and:

mvn antrun:run@my-execution

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

uses the execution configured in your pom.

这篇关于如何直接从命令行执行 maven 插件执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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