blob: d91359ea965a1a8011651c9ae000518b2e9f7b71 [file] [log] [blame]
<div class="wiki-content maincontent"><p>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.</p>
<h3>&#160;How to Use</h3>
<structured-macro ac:macro-id="dddd5c9b-0b05-4664-a0e1-2f85cf8e904b" ac:name="info" ac:schema-version="1"><parameter ac:name="title">Be Careful</parameter><rich-text-body>
<p>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'.</p></rich-text-body></structured-macro>
<blockquote><p>Replace the 5.7.0 version string with the version of your choosing, eg: 5.6.0, 5.8-SNAPSHOT</p></blockquote>
<p>In your Maven2 project, or using a minimal pom.xml like the following:</p>
<structured-macro ac:macro-id="74be901c-fa78-4225-8536-0118f832f63a" ac:name="code" ac:schema-version="1"><plain-text-body>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;project&gt;
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
&lt;groupId&gt;com.acme&lt;/groupId&gt;
&lt;artifactId&gt;run-amq&lt;/artifactId&gt;
&lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
&lt;/project&gt;</plain-text-body></structured-macro>
<p>just type:</p>
<structured-macro ac:macro-id="be7378b3-e88a-478f-8eb0-cc12f92dc3a7" ac:name="code" ac:schema-version="1"><plain-text-body>
mvn org.apache.activemq.tooling:maven-activemq-plugin:5.1:run
</plain-text-body></structured-macro>
<p>This will download the 5.7.0 version of the plugin, and spin up a broker using a simple configuration url of the form <code>broker:(tcp://localhost:61616)?useJmx=false&amp;persistent=false</code>. The necessary ActiveMQ jars will automatically be downloaded by Maven.</p>
<p>To configure log4j, provide the <code>-Dlog4j.configuration=<a shape="rect" class="external-link" href="file:///" rel="nofollow">file:///</a>&lt;full path to log4j.properties&gt;</code> system property on the mvn command line.</p>
<p>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 <code>conf/activemq.xml</code>, the following dependencies are required :</p>
<structured-macro ac:macro-id="a8cfc138-e1f3-4868-b986-7dafb111f494" ac:name="code" ac:schema-version="1"><plain-text-body>
&lt;build&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.activemq.tooling&lt;/groupId&gt;
&lt;artifactId&gt;maven-activemq-plugin&lt;/artifactId&gt;
&lt;version&gt;5.7.0&lt;/version&gt;
&lt;configuration&gt;
&lt;configUri&gt;xbean:file:../conf/activemq.xml&lt;/configUri&gt;
&lt;fork&gt;false&lt;/fork&gt;
&lt;systemProperties&gt;
&lt;property&gt;
&lt;name&gt;javax.net.ssl.keyStorePassword&lt;/name&gt;
&lt;value&gt;password&lt;/value&gt;
&lt;/property&gt;
&lt;property&gt;
&lt;name&gt;org.apache.activemq.default.directory.prefix&lt;/name&gt;
&lt;value&gt;./target/&lt;/value&gt;
&lt;/property&gt;
&lt;/systemProperties&gt;
&lt;/configuration&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.springframework&lt;/groupId&gt;
&lt;artifactId&gt;spring&lt;/artifactId&gt;
&lt;version&gt;2.5.5&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt;
&lt;artifactId&gt;jetty-xbean&lt;/artifactId&gt;
&lt;version&gt;6.1.11&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
&lt;artifactId&gt;camel-activemq&lt;/artifactId&gt;
&lt;version&gt;1.1.0&lt;/version&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;
</plain-text-body></structured-macro>
<p>&#160;and run it using:</p>
<structured-macro ac:macro-id="8b564575-8cc6-4315-85c6-d53147b3df62" ac:name="code" ac:schema-version="1"><plain-text-body>
mvn activemq:run
</plain-text-body></structured-macro>
<h3>&#160;Configuration Options</h3>
<table><tbody><tr><th colspan="1" rowspan="1"><p> Name </p></th><th colspan="1" rowspan="1"><p> Default </p></th><th colspan="1" rowspan="1"><p> Description </p></th></tr><tr><td colspan="1" rowspan="1"><p> configUri </p></td><td colspan="1" rowspan="1"><p> broker:(tcp://localhost:61616)?useJmx=false&amp;persistent=false </p></td><td colspan="1" rowspan="1"><p> The broker configuration URI that will be use to startup the broker. For more information, refer <link ac:tooltip="How do I embed a Broker inside a Connection"><page ri:content-title="How do I embed a Broker inside a Connection"></page><link-body>here</link-body></link><br clear="none" class="atl-forced-newline"> </p></td></tr><tr><td colspan="1" rowspan="1"><p> fork </p></td><td colspan="1" rowspan="1"><p> false </p></td><td colspan="1" rowspan="1"><p> If true, start up the broker in a separate thread, enabling maven to continue processing (Useful for integration testing).<br clear="none" class="atl-forced-newline"> </p></td></tr><tr><td colspan="1" rowspan="1"><p> systemProperties </p></td><td colspan="1" rowspan="1"><p> none </p></td><td colspan="1" rowspan="1"><p> Additional system properties that will be set.<br clear="none" class="atl-forced-newline"> </p></td></tr></tbody></table>
<p>&#160;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.</p></div>