如何从控制台运行 Maven 插件
我正在开发 Maven 插件
<modelVersion>4.0.0</modelVersion>
<groupId>com.breedish.cfit</groupId>
<artifactId>maven-cfitautomator-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>cfitautomator</name>
但是我如何从控制台运行它? 如果我运行 com.breedish.cfit:maven-cfitautomator-plugin:1.0-SNAPSHOT:run-goal 它总是说:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot execute mojo: run-goal. It requires a project with an existing pom.xml, but the build is not using one.
I'm developing maven plugin
<modelVersion>4.0.0</modelVersion>
<groupId>com.breedish.cfit</groupId>
<artifactId>maven-cfitautomator-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>cfitautomator</name>
But how i can run it from console?
if i run com.breedish.cfit:maven-cfitautomator-plugin:1.0-SNAPSHOT:run-goal it is always saying:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot execute mojo: run-goal. It requires a project with an existing pom.xml, but the build is not using one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
深入了解 maven-invoker-plugin 它可以为您提供支持开发 Maven 插件并进行环境集成测试等。因此您不需要手动安装该插件并手动测试它。
Take a deep look at the maven-invoker-plugin which can support you in developing Maven plugins with integration tests with environment etc. So you don't need to manually install that plugin and test it by hand.
您似乎没有在包含 pom 文件的目录中运行此命令。
它说它需要一个 POM 文件。
It seems you are not running this command in a directory which contains a pom file.
It says it needs a POM file.
使用
mvn install
将插件安装到本地存储库。然后按照您发布的方式使用它。Install your plugin to local repository using
mvn install
. Then use it as you posted.