在部署时在wildfly 8中指定Web应用程序的根上下文 [英] Specify root context for web application in wildfly 8 at deployment

查看:321
本文介绍了在部署时在wildfly 8中指定Web应用程序的根上下文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在部署时覆盖WEB-INF / jboss-web.xml中指定的根上下文?

Is it possible to override the root context specified in WEB-INF/jboss-web.xml at deploy time?

我有这个jboss-web.xml

I have this jboss-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
    <context-root>my-context</context-root>
</jboss-web>

我希望能够在不同的根环境中部署应用程序。 /我的某些环境的另一个上下文,但保留/我的上下文在其他环境中。

And I want to be able to deploy the application with different root context in in e.g. /another-context for some of my environments, but keep /my-context in other environments.

推荐答案

你可以通过 WildFly Maven插件(作为CI工作的一部分)或使用WildFly CLI 。

You can do this via WildFly Maven Plugin (as part of your CI job) or using the WildFly CLI.

maven变体类似于以下命令:

The maven variant would be like the following command:

org.wildfly.plugins:wildfly-maven-plugin:deploy-only
    -Dwildfly.deployment.filename=app.war 
    -Dwildfly.deployment.runtime.name=appcontext.war

该应用程序将部署在 / appcontext 下。

The app will be deployed under /appcontext.

请注意,您应该从 jboss-web.xml 中删除 context-root ,否则此值将始终获胜。

Note, you should remove the context-root from your jboss-web.xml otherwise this value will win always.

CLI变体可能如下(文档 ):

The CLI variant could look like (documentation):

[dply@as wildfly-8.2.0.Final]$ bin/jboss-cli.sh 
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect
[standalone@localhost:9990 /] deploy /path/to/app.war --runtime-name=appcontext.war

这篇关于在部署时在wildfly 8中指定Web应用程序的根上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆