在一个目标中结合许多Maven目标 [英] Combine many Maven goals within a single one

查看:80
本文介绍了在一个目标中结合许多Maven目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到现在为止,我正在使用命令 mvn clean compile hibernate3:hbm2java 来启动我的程序。有没有办法将这三个目标合并为一个目标,例如: mvn run mvn myapp:run

Until now, I'm using the command mvn clean compile hibernate3:hbm2java to launch my program. Is there any way to combine those three goals within a single one, e.g. mvn run or mvn myapp:run?

推荐答案

另一个与我的其他答案完全不同的解决方案是使用 exec-maven-plugin ,目标为 exec:exec

Another solution that differs completely from my other answer would be to use the exec-maven-plugin with the goal exec:exec.

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <configuration>
                <executable>mvn</executable>
                <arguments>
                    <argument>clean</argument>
                    <argument>compile</argument>
                    <argument>hibernate3:hbm2java</argument>
                </arguments>
            </configuration>
        </plugin>
    </plugins>
</build>

然后你就这样运行:

mvn exec:exec

通过这种方式这样做你没有改变任何其他插件,也没有绑定任何阶段。

By doing it this way you are not changing any of the other plugins and it is not bound to any phases either.

这篇关于在一个目标中结合许多Maven目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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