This sample is used to assemble Geronimo integrated ActiveMQ modules(including the new Geronimo plugin activemq-webconsole
), so that user can use it as a standalone JMS server with user-friendly web interfaces to manage JMS objects. In this sample, we will demonstrate how to use car-maven-plugin
to build a custom server assembly for both Jetty and Tomcat.
We will explain the pom.xml
files for Tomcat with ActiveMQ assembly. Likewise, you can apply the similar configurations to Jetty and ActiveMQ assembly.
root pom.xml of the sample
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.geronimo.samples</groupId> <artifactId>samples</artifactId> <version>2.2</version> </parent> <artifactId>csa-activemq</artifactId> <name>Custom Server Assembly Sample :: ActiveMQ</name> <packaging>pom</packaging> <version>2.2</version> <description> A Sample to demo how to use car-maven-plugin to assemble a server with ActiveMQ </description> <modules> <module>csa-activemq-jetty</module> <module>csa-activemq-tomcat</module> </modules> </project>
In the code above, make sure you specify the module IDs of the project and enclosed ones.
pom.xml for Tomcat and ActiveMQ assembly
To assemble a working server as we expected, you have to
- Include
org.apache.geronimo.framework.plugingroups::framework
in the dependencies; - Include other required modules, such as
org.apache.geronimo.plugins:activemq-webconsole-tomcat
org.apache.geronimo.configs:activemq-ra
- Specify you are going to assemble a new server with element
<packaging>server-assembly</packaging>
- Make sure all configuration files required by a running server wired to
car-maven-plugin
, such as:config.xml
config-substitutions.properties
artifact-aliases.properties
client_artifact_aliases.properties
jsr88-configurer-config.xml
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.geronimo.samples</groupId> <artifactId>csa-activemq</artifactId> <version>2.2</version> </parent> <groupId>org.apache.geronimo.samples</groupId> <artifactId>csa-activemq-tomcat</artifactId> <version>2.2</version> <name>Custom Server Assembly Sample :: ActiveMQ for Tomcat</name> <packaging>server-assembly</packaging> <description> A Sample to demo how to use car-maven-plugin to assemble a server with ActiveMQ </description> <dependencies> <dependency> <groupId>org.apache.geronimo.framework.plugingroups</groupId> <artifactId>framework</artifactId> <version>${geronimoVersion}</version> <type>car</type> </dependency> <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>activemq-ra</artifactId> <version>${geronimoVersion}</version> <type>car</type> </dependency> <dependency> <groupId>org.apache.geronimo.plugins</groupId> <artifactId>activemq-webconsole-tomcat</artifactId> <version>${geronimoVersion}</version> <type>car</type> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.geronimo.buildsupport</groupId> <artifactId>car-maven-plugin</artifactId> <configuration> <servers> <serverInstance> <name>default</name> <configFile>var/config/config.xml</configFile> <configSubstitutionsFile>var/config/config-substitutions.properties</configSubstitutionsFile> <configSubstitutionsPrefix>org.apache.geronimo.config.substitution.</configSubstitutionsPrefix> <artifactAliasesFile>var/config/artifact_aliases.properties</artifactAliasesFile> </serverInstance> <serverInstance> <name>client</name> <attributeManagerFrom>default</attributeManagerFrom> <artifactAliasesFile>var/config/client_artifact_aliases.properties</artifactAliasesFile> </serverInstance> <serverInstance> <name>offline</name> <configFile>var/config/offline-deployer-config.xml</configFile> <configSubstitutionsFile>var/config/config-substitutions.properties</configSubstitutionsFile> <configSubstitutionsPrefix>org.apache.geronimo.config.substitution.</configSubstitutionsPrefix> <artifactAliasesFile>var/config/artifact_aliases.properties</artifactAliasesFile> </serverInstance> <serverInstance> <name>jsr88</name> <configFile>var/config/jsr88-configurer-config.xml</configFile> <configSubstitutionsFile>var/config/config-substitutions.properties</configSubstitutionsFile> <configSubstitutionsPrefix>org.apache.geronimo.config.substitution.</configSubstitutionsPrefix> <artifactAliasesFile>var/config/artifact_aliases.properties</artifactAliasesFile> </serverInstance> </servers> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin> </plugins> </build> </project>
Assemble the server using maven command
When everything is ready, run the following command in root directory of the sample applicaiton. Then you will find the target server in target
directory of each module.
mvn clean install