I wanted to check what pom.xml should i use to create ActiveMQ publisher and consumer in standalone java application so i built a sample application, that you can download from
here
First i had to use the following directory structure
Then i did use the following pom.xml, only dependencies i have is on
activemq-core
, and slf4j-log4j and it takes care of downloading necessary jars
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.webspherenotes.jms</groupId>
<artifactId>HelloActiveMQMaven</artifactId>
<version>1.0</version>
<name>HelloActiveMQMaven</name>
<description>How to use ActiveMQ in Maven </description>
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>
com.webspherenotes.jms.HelloActiveMQPublisher</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Then i can execute the publisher by executing
mvn exec:java -Dexec.mainClass=com.webspherenotes.jms.HelloActiveMQPublisher
and i can execute the consumer by executing
mvn exec:java -Dexec.mainClass=com.webspherenotes.jms.HelloActiveMQConsumer
No comments:
Post a Comment