从命令行运行maven插件的语法是什么。 [英] What is the syntax to run a maven plugin from the command line.

查看:162
本文介绍了从命令行运行maven插件的语法是什么。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到这里已经有人问过:如何从命令行执行maven插件?
但我真的不明白答案。看起来语法的形式如下:

I see that this has already been asked over here: How to execute maven plugin from command line? but I don't really understand the answer. It looks like the syntax is of the form:

mvn foo:bar

但我不确定foo和bar应该是什么。

But I'm not really sure what foo and bar are supposed to be.

具体来说,我已经像这样配置了maven-resource-plugin:

Specifically I have configured the maven-resource-plugin like this:

<plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.5</version>
    <executions>
        <execution>
            <id>copy-resources</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <!--configuration here-->
            </configuration>
        </execution>
    </executions>
</plugin>

我尝试了几种 mvn artifactId | id | phase | goal的排列:artifactidId | id | phase | goal 但它们都没有工作。我想我会停止试图强暴它,只是问互联网。此外,这是在任何地方记录?

I've tried several permutations of mvn artifactId|id|phase|goal:artifactidId|id|phase|goal but none of them are working. I figured i'd stop trying to brute-force it and just ask the internet. Also, is this documented anywhere?

推荐答案

有3种模式:

groupId:artifactId:version:goal
groupId:artifactId:goal
prefix:goal

如果从带有pom.xml的位置运行此命令但未指定版本,Maven将在build-section中搜索匹配的插件。
前缀通常(并非总是)被识别为artifactId的一部分,例如 maven-help-plugin 的前缀为 help 。插件文档应该为您提供确切的前缀。

If you run this from a location with a pom.xml and you haven't specified the version, Maven will search for a matching plugin in the build-section. The prefix can often (not always) be recognized as part of the artifactId, e.g. maven-help-plugin has the prefix help. The plugin documentation should give you the exact prefix.

这篇关于从命令行运行maven插件的语法是什么。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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