我正在尝试测试我的应用程序,它将消息发送到队列(Activemq)。
我有一个maven测试项目,它可以从javax.jms.MessageConsumer使用者消费。
如果我要在maven构建中启动activemq,我正在关注here的答案。但是,它会在启动activemq时停止,并且不会将构建移动到测试执行。
我的构建xml部分如下所示,
<plugin>
<groupId>org.apache.activemq.tooling</groupId>
<artifactId>maven-activemq-plugin</artifactId>
<version>5.7.0</version>
<executions>
<execution>
<goals>
<goal>run</goal>
</goals>
<phase>process-test-classes</phase>
</execution>
</executions>
</plugin>
我正在寻找一种方法让maven在activemq启动后转移到下一阶段。
我也尝试了新版本的插件,即activemq-maven-plugin;
<plugin>
<groupId>org.apache.activemq.tooling</groupId>
<artifactId>activemq-maven-plugin</artifactId>
<version>5.15.1</version>
<executions>
<execution>
<goals>
<goal>run</goal>
</goals>
<phase>process-test-classes</phase>
</execution>
</executions>
</plugin>
无论哪种情况,我的maven构建都停在......
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) @ my-automation ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to C:\Users\xyz\my-automation\target\test-classes
[INFO]
[INFO] --- maven-activemq-plugin:5.7.0:run (default) @ my-automation ---
[INFO] Loading broker configUri: broker:(tcp://localhost:61616)?useJmx=false&persistent=false
[INFO] Using Persistence Adapter: MemoryPersistenceAdapter
[INFO] Apache ActiveMQ 5.7.0 (localhost, ID:XYZ-0001:1) is starting
[INFO] Listening for connections at: tcp://127.0.0.1:61616
[INFO] Connector tcp://127.0.0.1:61616 Started
[INFO] Apache ActiveMQ 5.7.0 (localhost, ID:XYZ-0001:1) started
[INFO] For help or more information please see: http://activemq.apache.org
这是activemq启动的关键点。
我怎么能从这一点开始呢?
将以下内容添加到插件声明中:
<configuration>
<fork>true</fork>
</configuration>