【发布时间】:2010-05-03 23:03:10
【问题描述】:
我一直在尝试让 activemq-maven-plugin 在包的类路径中配置运行 activemq。不过,我运气不太好。似乎activemq-maven-plugin 只是忽略了本地包的资源(resources/main/conf/activemq.properties)。我检查了 jar 和目标/类,它们内置在正确的本地。如果我在 activemq.xml 中取出 PropertyPlaceholderConfigurer bean,我可以让插件运行 (mvn activemq:run) 我做错了什么吗?
这是输出
[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] ------------------------------------------------------------------------
这里是 pom.xml,我指定了通过文件查找 activemq.xml 的插件,它可以工作。
但是,在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>
这里是 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>
这里是 src/main/resources/conf/activemq.properties
activemq.port=61616
【问题讨论】:
标签: maven-2 maven-plugin activemq