运行wildfly:run目标后,是否有办法进行Maven构建?

时间:2019-12-06 12:12:43

标签: maven jboss wildfly

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

[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

如您所见,在这种情况下,部署目标并未“锁定” CLI,但构建过程仍将持续到结束

1 个答案:

答案 0 :(得分:1)

wildfly:run命令应有此行为,一旦完成测试,就应该从外部中断服务器。引用the goal's documentation

  

该目标将一直阻塞,直到取消或从管理客户端调用关机为止。

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