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.

ActiveMQ提供了一个Maven2插件,可以轻松启动JMS代理。在您的Maven2项目中快速启动一个消息代理以进行调试或进行集成测试是非常有用的。

 How to Use

如何使用

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

ActiveMQ中的maven插件在5.8.0版本中被重新命名,以便更好地遵循maven插件的命名约定。ActiveMQ代理插件已经从“maven-activemq-plugin”改为“ActiveMQ -maven-plugin”。

Replace the 5.7.0 version string with the version of your choosing, eg: 5.6.0, 5.8-SNAPSHOT

用你选择的版本替换5.7.0版本的字符串,例如:5.6.0,5.8-SNAPSHOT。

In your Maven2 project, or using a minimal pom.xml like the following:

在您的Maven2项目中,或者使用最小的pom。xml如下:

<?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 broker:(tcp://localhost:61616)?useJmx=false&persistent=false. The necessary ActiveMQ jars will automatically be downloaded by Maven.

这将下载该插件的5.7.0版本,并使用表单代理的简单配置url (tcp://localhost:61616)来启动代理:useJmx=false&persistent=false。Maven将自动下载必要的ActiveMQ jar文件。

To configure log4j, provide the -Dlog4j.configuration=file:///<full path to log4j.properties> system property on the mvn command line.

要配置log4j,请提供-Dlog4j。配置=文件:/ / / < log4j的完整路径。属性>系统属性在mvn命令行。

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 conf/activemq.xml, the following dependencies are required :

如果您需要一个更高级的配置,比如spring support、jetty webconsole或嵌入的camel,那么您可以在pom中添加插件。xml并提供必需的可选依赖项。为默认conf / activemq。xml,需要以下依赖项:

 <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

配置选项

Name

的名字

Default

默认的

Description

描述

configUri

configUri

broker:(tcp://localhost:61616)?useJmx=false&persistent=false

代理:(tcp:/ / localhost:61616)? useJmx = false&persistent = false

The broker configuration URI that will be use to startup the broker. For more information, refer here

将用于启动代理的代理配置URI。有关更多信息,请参见这里。

fork

false

If true, start up the broker in a separate thread, enabling maven to continue processing (Useful for integration testing).

如果是正确的,则在单独的线程中启动代理,使maven能够继续处理(对集成测试有用)。

systemProperties

systemProperties

none

没有一个

Additional system properties that will be set.

将设置的附加系统属性。

 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.

注意:默认情况下,代理插件将设置activemq。基地,activemq。家,org.apache.activemq.default.directory.prefix derby.system。家。/ /目标。这意味着所有的数据文件夹都将在那里创建,因此很容易被运行的mvn clean删除。

© 2004-2011 The Apache Software Foundation.
Apache ActiveMQ, ActiveMQ, Apache, the Apache feather logo, and the Apache ActiveMQ project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram