问题
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