Eri*_*ric 5 jboss properties virtual-hosts pom.xml maven
我正在尝试将我的项目设置为根据环境使用不同的虚拟主机名.
我知道我可以在每个目录中使用单独的jboss-web.xml文件创建目录.但我最近将这个项目移到了maven,并希望利用这些配置文件.我已经设置了数据库,因此可以使用过滤器通过配置文件对它们进行不同的配置.
的jboss-web.xml中:
<jboss-web>
<context-root>/</context-root>
<virtual-host>${jbossweb.virtualhost}</virtual-host>
</jboss-web>
Run Code Online (Sandbox Code Playgroud)
特定于环境的属性文件具有以下条目:
jbossweb.virtualhost=hostname.domain.com
Run Code Online (Sandbox Code Playgroud)
pom文件构建部分具有此定义
<filters>
<filter>src/main/filters/filter-${env}.properties</filter>
</filters>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
</resource>
</resources>
Run Code Online (Sandbox Code Playgroud)
只是为了衡量,配置文件部分具有以下配置:
<profile>
<id>dev</id>
<properties>
<env>dev</env>
</properties>
</profile>
Run Code Online (Sandbox Code Playgroud)
我甚至不确定我想做的事情是否可行.当我尝试它时,Jboss-web.xml在虚拟主机位置具有变量名称而不是值.
我吠叫错了树吗?
谢谢,
埃里克
Eri*_*ric 11
实际上,我发现了一种方法:
jboss-web.xml现在看起来像这样:
<jboss-web>
<context-root>${jbossweb.contextroot}</context-root>
<virtual-host>${jbossweb.virtualhost}</virtual-host>
</jboss-web>
Run Code Online (Sandbox Code Playgroud)
属性文件如下所示:
jbossweb.virtualhost=hostname
jbossweb.contextroot=/
Run Code Online (Sandbox Code Playgroud)
然后pom部分对于maven war插件配置看起来像这样:
<webResources>
<resource>
<directory>src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<include>jboss-web.xml</include>
<targetPath>/WEB-INF</targetPath>
</resource>
</webResources>
Run Code Online (Sandbox Code Playgroud)
过滤器在插件部分上方定义,但在构建部分内如下:
<filters>
<filter>src/main/filters/filter-${env}.properties</filter>
</filters>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3769 次 |
| 最近记录: |