我如何在Maven中显示一条消息 [英] How can I display a message in Maven
问题描述
如何在Maven中显示消息?
How can I display a message in Maven?
在ant中,我们确实有"echo"来显示消息,但是在maven中,我该怎么做?
In ant, we do have "echo" to display a message, but in maven, how can I do that?
推荐答案
您可以使用antrun插件:
You can use the antrun plugin:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Hello world!</echo>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
但是,一个问题是,您必须选择构建生命周期以将其绑定到(我的示例将插件绑定到generate-resources
).与Ant不同,您不是自己控制生命周期,而只是将插件绑定到预定义生命周期中的某些点.根据您的实际尝试,对于您的用例而言,这可能有意义,也可能没有意义.
One issue though is that you have to choose what phase of the build lifecycle to bind this to (my example has the plugin bound to generate-resources
). Unlike Ant, you aren't controlling the lifecycle yourself, but rather just binding plugins to certain points in a pre-defined lifecycle. Depending on what you are actually trying to do, this may or may not make sense for your use case.
这篇关于我如何在Maven中显示一条消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!