|
ActiveMQ provides a Maven2 plugin to easily startup a JMS broker. It is useful to quickly boot up a message broker in your Maven2 project for debugging or for doing integration tests. How to UseBe Careful The maven plugins in ActiveMQ have been renamed in version 5.8.0+ to better follow the Maven plugin naming conventions. The ActiveMQ Broker plugin has changed from 'maven-activemq-plugin' to 'activemq-maven-plugin'.
In your Maven2 project, or using a minimal pom.xml like the following: <?xml version="1.0" encoding="UTF-8"?> <project> <modelVersion>4.0.0</modelVersion> <groupId>com.acme</groupId> <artifactId>run-amq</artifactId> <version>1.0-SNAPSHOT</version> </project> just type: mvn org.apache.activemq.tooling:maven-activemq-plugin:5.1:run This will download the 5.7.0 version of the plugin, and spin up a broker using a simple configuration url of the form To configure log4j, provide the If you require a more advanced configuration with spring support, the jetty webconsole or with embedded camel you can add the plugin in your pom.xml and provide the required optional dependencies. For the default
<build>
<plugins>
<plugin>
<groupId>org.apache.activemq.tooling</groupId>
<artifactId>maven-activemq-plugin</artifactId>
<version>5.7.0</version>
<configuration>
<configUri>xbean:file:../conf/activemq.xml</configUri>
<fork>false</fork>
<systemProperties>
<property>
<name>javax.net.ssl.keyStorePassword</name>
<value>password</value>
</property>
<property>
<name>org.apache.activemq.default.directory.prefix</name>
<value>./target/</value>
</property>
</systemProperties>
</configuration>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.5</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-xbean</artifactId>
<version>6.1.11</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-activemq</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
and run it using: mvn activemq:run Configuration Options
Note: By default, the broker plugin will set activemq.base, activemq.home, org.apache.activemq.default.directory.prefix, derby.system.home to ./target/. This means that all data folders will be created there, hence will easily be deleted by running mvn clean. |