[英]undeploy jboss cli fails if the war not exists
我試圖取消部署並使用jboss-as-maven-plugin將war文件部署到jboss EAP 6,並在我的項目pom.xm中提到了以下幾行。 如果尚未在jboss中部署WAR,則Undeploy cli步驟將失敗。 我希望如果WAR不存在,可以跳過此步驟,並在下一步中繼續進行新的部署。 有解決這個問題的主意嗎?
`[ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.9.Final:execute-commands (unassign-war) on project chexreseller: Execution unassign-war of goal org.jboss.as.plugins:jboss-as-maven-plugin:7.9.Final:execute-commands failed: Operation failed: {"domain-failure-description" => {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => "JBAS014807: Management resource '[ [ERROR] (\\"server-group\\" => \\"web-server-group\\"), [ERROR] (\\"deployment\\" => \\"xxx.war\\") [ERROR] ]' not found"}}}}} [ERROR] -> [Help 1]`
<plugin> <groupId>org.jboss.as.plugins</groupId> <artifactId>jboss-as-maven-plugin</artifactId> <version>7.9.Final</version> <configuration> <timeout>60000</timeout> <username>${uname}</username> <password>${password}</password> <hostname>${hostname}</hostname> </configuration> <executions> <execution> <id>upload-war</id> <phase>deploy</phase> <goals> <goal>deploy</goal> </goals> <configuration> <deployEnabled>false</deployEnabled> <force>true</force> <domain> <server-groups> <server-group>myservergrp</server-group> </server-groups> </domain> </configuration> </execution> <execution> <id>unassign-war</id> <phase>deploy</phase> <goals> <goal>execute-commands</goal> </goals> <configuration> <executeCommands> <batch>true</batch> <commands> <command>undeploy xxx.war --server-groups=myservergrp</command> <command>undeploy yyy.war --server-groups=myservergrp</command> </commands> </executeCommands> </configuration> </execution> <execution> <id>enable-this-war</id> <phase>deploy</phase> <goals> <goal>execute-commands</goal> </goals> <configuration> <executeCommands> <batch>true</batch> <commands> <command>deploy --name=xxx.war --server-groups=myservergrp</command> <command>deploy --name=yyy.war --server-groups=myservergrp</command> </commands> </executeCommands> </configuration> </execution> </executions> </plugin>
我沒有親自嘗試過,但是通過查看https://docs.jboss.org/jbossas/7/plugins/maven/latest/examples/complex-example.html中的maven插件文檔,我認為您只是想念另一個配置子元素,即:
<configuration>
<ignoreMissingDeployment>true</ignoreMissingDeployment>
</configuration>
我可以通過在pom.xml中僅添加以下幾行來解決,該行將替換已部署的組件,如果不存在則部署新組件
<executions>
<execution>
<id>upload-war</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<filename>xxx.war</filename>
<deployEnabled>false</deployEnabled>
<ignoreMissingDeployment>true</ignoreMissingDeployment>
<force>true</force>
<domain>
<server-groups>
<server-group>web-server-group</server-group>
</server-groups>
</domain>
</configuration>
</execution>
</executions>
注意:如果未提及文件名標簽,則將采用默認項目名稱進行部署
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.