如何使用maven执行.cli命令?是什么maven插件帮助我这么做的?
我想在预集成测试阶段执行一些cli命令。
我想运行的命令是
jms-queue add --queue-address=ProcessingEngine --entries=java:global/jms/ProcessingEngine我使用的插件是
野蝇-maven插件
我使用的完整配置是
<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>我明白这个例外
错误未能在项目集成上执行目标org.wildfly.plugins:wildfly-maven-plugin:1.1.0.Alpha11:execute-commands (start-jms-队列)-test: Execution jms-目标org.wildfly.plugins:wildfly-maven-plugin:1.1.0.Alpha11:execute-commands队列失败:命令‘jms-队列添加-队列-地址=ProcessingEngine-条目=java:全局/jms/ProcessingEngine,java:/jms/myApp/ProcessingEngine’是无效的。命令在当前上下文中不可用(例如,所需的子系统或与控制器的连接可能不可用)。->帮助1
如果我使用命令行并手动设置JAVA_OPTS以使用独立的Ful.xml,再次启动服务器并连接到它,然后从命令行运行add jms查询,它可以工作。
发布于 2016-12-09 08:35:53
我设法使用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>https://stackoverflow.com/questions/40998974
复制相似问题