Maven命令在集成测试之前运行activemq [英] Maven command to run activemq before intergation tests

查看:200
本文介绍了Maven命令在集成测试之前运行activemq的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的maven全新安装中运行ActiveMQ,以便它启动activemq,然后运行我的测试.我已将插件包含在pom.xml中,并添加了用于配置mq详细信息的mq配置文件.当我在一个控制台上运行activeMq并在其他控制台上运行maven clean install时(在2个独立的控制台上有2条独立的命令),它可以成功运行并通过所有测试.但是,有没有一种方法可以在同一控制台上使用1命令运行activemq并进行全新安装?基本上,我希望当我执行 mvn clean test install 时,它应该首先自动启动mq,然后继续进行测试...

I need to run ActiveMQ in my maven clean install, so that it starts up activemq and then runs my tests. I have included the plugin in pom.xml and added the mq config file for configuring mq details. It runs successfully and all test pass when I run activeMq on one console and run maven clean install on others (2 separate commands on 2 separate consoles). But is there a way I can run activemq and clean install both with 1 command on the same console? Basically I wish that when I do mvn clean test install, it should automatically fire-up mq first and then proceed with the tests...

我尝试使用 mvn activemq:run clean test install mvn clean test install activemq:run 之类的命令.但是它要么执行全新安装,要么运行activemq ...

I have tried using commands like mvn activemq:run clean test install or mvn clean test install activemq:run. But it either does the clean install or runs the activemq...

如何结合这两个命令( activemq:run mvn clean test install )?

How do I combine these 2 commands(activemq:run and mvn clean test install)?

推荐答案

使用<build><plugins>构造附加Maven目标和插件.:

Attach the maven goal and plugin using the <build><plugins> construct.:

<build>   
    <plugins>
        <plugin>
            <groupId>org.apache.activemq.tooling</groupId>
            <artifactId>maven-activemq-plugin</artifactId>
            <version>...</version>
            <executions>
                <execution>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <phase>process-test-classes</phase> <!-- or other phase before the test phase -->
                </execution>
            </executions>    
        </plugin>
    </plugins>
</build>

这篇关于Maven命令在集成测试之前运行activemq的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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