Maven command to run activemq before intergation tests

青春壹個敷衍的年華 提交于 2020-01-06 07:27:21

问题


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...

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...

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


回答1:


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>


来源:https://stackoverflow.com/questions/29307763/maven-command-to-run-activemq-before-intergation-tests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!