有没有办法在 运行 wildfly:run 目标之后使用 maven 构建?

Is there a way to porsue with maven build after running wildfly:run goal?

我想在 wildfly:run 目标执行后完成 Maven 构建生命周期。
事实上,wildfly:run 目标启动了一个独立的应用程序服务器,从那时起,CLI 仅显示 Wildfly 的日志消息。

[INFO] --- wildfly-maven-plugin:2.1.0.Beta1-SNAPSHOT:run (default) @ PrimeFaces1 ---
[WARNING] The POM for org.wildfly.plugins:wildfly-plugin-core:jar:2.1.0.Beta1-SNAPSHOT is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] JAVA_HOME : C:\Program Files\Java\jdk1.8.0_201\jre
[INFO] JBOSS_HOME: C:\Users\Consul19\eclipse-workspace\MultiRunTest\PrimeFaces1\target\wildfly-18.0.1.Final
[INFO] JAVA_OPTS : -Xms64m -Xmx512m -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Djboss.modules.system.pkgs=org.jboss.byteman
[INFO] Server is starting up. Press CTRL + C to stop the server.
[INFO] JBoss Threads version 2.3.3.Final
[INFO] JBoss Remoting version 5.0.12.Final
[INFO] XNIO version 3.7.2.Final
[INFO] XNIO NIO Implementation Version 3.7.2.Final
[INFO] ELY00001: WildFly Elytron version 1.9.1.Final
13:04:25,585 INFO  [org.jboss.modules] (main) JBoss Modules version 1.9.1.Final
13:04:26,228 INFO  [org.jboss.msc] (main) JBoss MSC version 1.4.11.Final
13:04:26,248 INFO  [org.jboss.threads] (main) JBoss Threads version 2.3.3.Final
13:04:26,472 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: WildFly Full 18.0.1.Final (WildFly Core 10.0.3.Final) starting
13:04:27,800 INFO  [org.wildfly.security] (ServerService Thread Pool -- 28) ELY00001: WildFly Elytron version 1.10.4.Final

实际上我想 运行 下一个目标但是服务器控制了 CLI

此外,在 pom.xml 中,我试图用 wildfly:deploy 目标来掩盖 wildfly:run,在本地 JBOSS 服务器上部署工件(已经开始),在这种情况下,maven 构建一直持续到结束。

[INFO] --- maven-war-plugin:2.2:war (default-war) @ PrimeFaces1 ---
[INFO] Packaging webapp
[INFO] Assembling webapp [PrimeFaces1] in [C:\Users\Consul19\eclipse-workspace\MultiRunTest\PrimeFaces1\target\PrimeFaces1-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\Consul19\eclipse-workspace\MultiRunTest\PrimeFaces1\src\main\webapp]
[INFO] Webapp assembled in [128 msecs]
[INFO] Building war: C:\Users\Consul19\eclipse-workspace\MultiRunTest\PrimeFaces1\target\PrimeFaces1-1.0-SNAPSHOT.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO]
[INFO] <<< wildfly-maven-plugin:2.1.0.Beta1-SNAPSHOT:deploy (default-cli) < package @ PrimeFaces1 <<<
[INFO]
[INFO]
[INFO] --- wildfly-maven-plugin:2.1.0.Beta1-SNAPSHOT:deploy (default-cli) @ PrimeFaces1 ---
[INFO] JBoss Threads version 2.3.3.Final
[INFO] JBoss Remoting version 5.0.12.Final
[INFO] XNIO version 3.7.2.Final
[INFO] XNIO NIO Implementation Version 3.7.2.Final
[INFO] ELY00001: WildFly Elytron version 1.9.1.Final
[INFO]
[INFO] --------------------< com.mkyong.core:PrimeFaces2 >---------------------
[INFO] Building PrimeFaces2 1.0-SNAPSHOT                                  [3/3]
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] >>> wildfly-maven-plugin:2.1.0.Beta1-SNAPSHOT:deploy (default-cli) > package @ PrimeFaces2 >>>
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ PrimeFaces2 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Consul19\eclipse-workspace\MultiRunTest\PrimeFaces2\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ PrimeFaces2 ---
[INFO] Nothing to compile - all classes are up to date

如您所见,在这种情况下,部署目标不是 "lock" CLI,但构建过程仍会继续,直到结束

此行为是 wildfly:run 命令的预期行为,您应该在完成测试后从外部中断服务器。引用 the goal's documentation,

This goal will block until cancelled or a shutdown is invoked from a management client.

如果这不适合您,您可以使用 wildlfy:start 后跟 wildfly:deploy