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”。
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 这将下载该插件的5.7.0版本,并使用表单代理的简单配置url (tcp://localhost:61616)来启动代理:useJmx=false&persistent=false。Maven将自动下载必要的ActiveMQ jar文件。 To configure log4j, provide the 要配置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 如果您需要一个更高级的配置,比如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配置选项
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删除。 |