如何用maven添加jms队列?
How to add jms queue with maven?
如何使用 maven 执行 .cli 命令?什么 Maven 插件可以帮助我做到这一点?
我想在预集成测试阶段执行一些cli命令。
我想要运行的命令是
jms-queue add --queue-address=ProcessingEngine --entries=java:global/jms/ProcessingEngine
我使用的插件是
wildfly-maven-plugin
我使用的完整配置是
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.1.0.Alpha11</version>
<executions>
<execution>
<id>start-wildfly</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<startupTimeout>420</startupTimeout>
<jbossHome>${env.WILDFLY_HOME}</jbossHome>
<serverConfig>standalone-full.xml</serverConfig>
<javaOpts>
<javaOpts>-DIGNITE_HOME=${env.TEMP}</javaOpts>
<javaOpts>-Xms512m</javaOpts>
<javaOpts>-Xmx4094m</javaOpts>
<javaOpts>${ITargLine}</javaOpts>
<javaOpts>-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n</javaOpts>
<javaOpts>-Dwkfs.local.configuration.file=${project.build.testOutputDirectory}/wkfs-external.properties</javaOpts>
</javaOpts>
</configuration>
</execution>
<execution>
<id>start-jms-queues</id>
<phase>pre-integration-test</phase>
<goals>
<goal>execute-commands</goal>
</goals>
<configuration>
<commands>
<executeCommands>
<!-- Create Processing Engine queue -->
jms-queue add --queue-address=ProcessingEngine --entries=java:global/jms/ProcessingEngine
</executeCommands>
<executeCommands>
<!-- Create Processing Engine notification queue -->
jms-topic add --topic-address=ProcessingEngineNotification --entries=java:global/jms/ProcessingEngineNotification
</executeCommands>
</commands>
</configuration>
</execution>
</executions>
</plugin>
我得到这个异常
[ERROR] Failed to execute goal
org.wildfly.plugins:wildfly-maven-plugin:1.1.0.Alpha11:execute-commands
(start-jms-queues) on project integration-test: Execution
start-jms-queues of goal
org.wildfly.plugins:wildfly-maven-plugin:1.1.0.Alpha11:execute-commands
failed: Command 'jms-queue add --queue-address=ProcessingEngine
--entries=java:global/jms/ProcessingEngine,java:/jms/myApp/ProcessingEngine'
is invalid. The command is not available in the current context (e.g.
required subsystems or connection to the controller might be
unavailable). -> [Help 1]
如果我使用命令行并手动设置 JAVA_OPTS 使用独立-full.xml,再次启动服务器并连接到它,然后 运行 添加 jms 查询从命令行,它有效。
我设法使用 add-resource
目标
添加了一个 jms 队列
<execution>
<id>add-jms-queue</id>
<phase>pre-integration-test</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<address>subsystem=messaging,hornetq-server=default,jms-queue=ProcessingEngine</address>
<properties>
<durable>true</durable>
<entries>!!["java:global/jms/ProcessingEngine"]</entries>
</properties>
</resource>
<resource>
<address>subsystem=messaging,hornetq-server=default,jms-topic=ProcessingEngineNotification</address>
<properties>
<durable>true</durable>
<entries>!!["java:global/jms/ProcessingEngineNotification"]</entries>
</properties>
</resource>
</resources>
</configuration>
</execution>
如何使用 maven 执行 .cli 命令?什么 Maven 插件可以帮助我做到这一点?
我想在预集成测试阶段执行一些cli命令。
我想要运行的命令是
jms-queue add --queue-address=ProcessingEngine --entries=java:global/jms/ProcessingEngine
我使用的插件是
wildfly-maven-plugin
我使用的完整配置是
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.1.0.Alpha11</version>
<executions>
<execution>
<id>start-wildfly</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<startupTimeout>420</startupTimeout>
<jbossHome>${env.WILDFLY_HOME}</jbossHome>
<serverConfig>standalone-full.xml</serverConfig>
<javaOpts>
<javaOpts>-DIGNITE_HOME=${env.TEMP}</javaOpts>
<javaOpts>-Xms512m</javaOpts>
<javaOpts>-Xmx4094m</javaOpts>
<javaOpts>${ITargLine}</javaOpts>
<javaOpts>-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n</javaOpts>
<javaOpts>-Dwkfs.local.configuration.file=${project.build.testOutputDirectory}/wkfs-external.properties</javaOpts>
</javaOpts>
</configuration>
</execution>
<execution>
<id>start-jms-queues</id>
<phase>pre-integration-test</phase>
<goals>
<goal>execute-commands</goal>
</goals>
<configuration>
<commands>
<executeCommands>
<!-- Create Processing Engine queue -->
jms-queue add --queue-address=ProcessingEngine --entries=java:global/jms/ProcessingEngine
</executeCommands>
<executeCommands>
<!-- Create Processing Engine notification queue -->
jms-topic add --topic-address=ProcessingEngineNotification --entries=java:global/jms/ProcessingEngineNotification
</executeCommands>
</commands>
</configuration>
</execution>
</executions>
</plugin>
我得到这个异常
[ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.1.0.Alpha11:execute-commands (start-jms-queues) on project integration-test: Execution start-jms-queues of goal org.wildfly.plugins:wildfly-maven-plugin:1.1.0.Alpha11:execute-commands failed: Command 'jms-queue add --queue-address=ProcessingEngine --entries=java:global/jms/ProcessingEngine,java:/jms/myApp/ProcessingEngine' is invalid. The command is not available in the current context (e.g. required subsystems or connection to the controller might be unavailable). -> [Help 1]
如果我使用命令行并手动设置 JAVA_OPTS 使用独立-full.xml,再次启动服务器并连接到它,然后 运行 添加 jms 查询从命令行,它有效。
我设法使用 add-resource
目标
<execution>
<id>add-jms-queue</id>
<phase>pre-integration-test</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<address>subsystem=messaging,hornetq-server=default,jms-queue=ProcessingEngine</address>
<properties>
<durable>true</durable>
<entries>!!["java:global/jms/ProcessingEngine"]</entries>
</properties>
</resource>
<resource>
<address>subsystem=messaging,hornetq-server=default,jms-topic=ProcessingEngineNotification</address>
<properties>
<durable>true</durable>
<entries>!!["java:global/jms/ProcessingEngineNotification"]</entries>
</properties>
</resource>
</resources>
</configuration>
</execution>