activemq-maven-plugin ignore files in classpath?

Posted by Oscar Chan on Stack Overflow See other posts from Stack Overflow or by Oscar Chan
Published on 2010-05-03T23:03:10Z Indexed on 2010/05/03 23:08 UTC
Read the original article Hit count: 758

Filed under:
|

I have been trying to get activemq-maven-plugin to run activemq with configuration in classpath of the bundle. However, I don't have much luck. It seems that the activemq-maven-plugin just ignore resources (resources/main/conf/activemq.properties) the local bundle. I checked the jar and target/classes and they are built into the right local. I am able to get plugin to run (mvn activemq:run) if I take out the PropertyPlaceholderConfigurer bean in the activemq.xml Did I do anything wrong?

Here is the output

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to start ActiveMQ Broker

Embedded error: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [conf/activemq.properties] cannot be opened because it does not exist
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Mon May 03 15:56:05 PDT 2010
[INFO] Final Memory: 11M/79M
[INFO] ------------------------------------------------------------------------

Here is the pom.xml, which I specific the plugin to look up activemq.xml via file, that works.

However, in the activemq.xml

<?xml version="1.0"?>
<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>
  <groupId>oc.test</groupId>
  <artifactId>mq</artifactId>
  <version>0.1</version>
  <name>mq</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.activemq.tooling</groupId>
        <artifactId>maven-activemq-plugin</artifactId>
        <version>5.3.1</version>
        <configuration>
          <configUri>xbean:file:src/main/resources/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>
        </dependencies>
      </plugin>
    </plugins>
  </build>
</project>

Here is the src/main/resources/conf/activemq.xml

<?xml version="1.0"?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core
  http://activemq.apache.org/schema/core/activemq-core.xsd
  ">

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>classpath:conf/activemq.properties</value>
        </property>
        <property name="systemPropertiesModeName"  value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
    </bean>

  <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="./data">
    <!-- The transport connectors ActiveMQ will listen to -->
    <transportConnectors>
      <transportConnector name="openwire" uri="tcp://localhost:61616"/>
    </transportConnectors>
  </broker>
</beans>

Here is the src/main/resources/conf/activemq.properties

activemq.port=61616

© Stack Overflow or respective owner

Related posts about activemq

Related posts about maven-plugin