# Maven Plugins Since Artemis 1.1.0 Artemis provides the possibility of using Maven Plugins to manage the life cycle of servers. ## When to use it These Maven plugins were initially created to manage server instances across our examples. They can create a server, start, and do any CLI operation over servers. You could for example use these maven plugins on your testsuite or deployment automation. ## Goals There are three goals that you can use - create This will create a server accordingly to your arguments. You can do some extra tricks here such as installing extra libraries for external modules. - cli This will perform any CLI operation. This is basically a maven expression of the CLI classes - runClient This is a simple wrapper around classes implementing a static main call. Notice that this won't spawn a new VM or new Thread. ## Declaration On your pom, use the plugins section: ```xml org.apache.activemq artemis-maven-plugin ``` ## create goal I won't detail every operation of the create plugin here, but I will try to describe the main parameters: Name | Description :--- | :--- configuration | A place that will hold any file to replace on the configuration. For instance if you are providing your own broker.xml. Default is "${basedir}/target/classes/activemq/server0" home | The location where you downloaded and installed artemis. Default is "${activemq.basedir}" alternateHome | This is used case you have two possible locations for your home (e.g. one under compile and one under production instance | Where the server is going to be installed. Default is "${basedir}/target/server0" liblist[] | A list of libraries to be installed under ./lib. ex: "org.jgroups:jgroups:3.6.0.Final" Example: ```xml create create ${noServer} ``` ## cli goal Some properties for the CLI Name | Description :--- | :--- configuration | A place that will hold any file to replace on the configuration. For instance if you are providing your own broker.xml. Default is "${basedir}/target/classes/activemq/server0" home | The location where you downloaded and installed artemis. Default is "${activemq.basedir}" alternateHome | This is used case you have two possible locations for your home (e.g. one under compile and one under production instance | Where the server is going to be installed. Default is "${basedir}/target/server0" Similarly to the create plugin, the artemis exampels are using the cli plugin. Look at them for concrete examples. Example: ```xml start cli true ${noServer} tcp://localhost:61616 run ``` ### runClient goal This is a simple solution for running classes implementing the main method. Name | Description :--- | :--- clientClass | A class implement a static void main(String arg[]) args | A string array of arguments passed to the method Example: ```xml runClient runClient org.apache.activemq.artemis.jms.example.QueueExample ``` ### Complete example The following example is a copy of the /examples/features/standard/queue example. You may refer to it directly under the examples directory tree. ```xml 4.0.0 org.apache.activemq.examples.broker jms-examples 1.1.0 queue jar ActiveMQ Artemis JMS Queue Example ${project.basedir}/../../../.. org.apache.activemq artemis-jms-client ${project.version} org.apache.activemq artemis-maven-plugin create create ${noServer} start cli true ${noServer} tcp://localhost:61616 run runClient runClient org.apache.activemq.artemis.jms.example.QueueExample stop cli ${noServer} stop org.apache.activemq.examples.broker queue ${project.version} ```