我正在尝试将我的项目设置为根据环境使用不同的虚拟主机名。
我知道我可以在每个目录中使用单独的 jboss-web.xml 文件创建目录。但我最近将这个项目移到了 maven 并想利用配置文件。我已经设置了数据库,因此配置文件可以使用过滤器对它们进行不同的配置。
jboss-web.xml:
<jboss-web>
<context-root>/</context-root>
<virtual-host>${jbossweb.virtualhost}</virtual-host>
</jboss-web>
特定于环境的属性文件具有以下条目:
jbossweb.virtualhost=hostname.domain.com
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>
为了更好地衡量,profiles 部分具有以下配置:
<profile>
<id>dev</id>
<properties>
<env>dev</env>
</properties>
</profile>
我什至不确定我想做的事情是否可行。当我尝试它时,Jboss-web.xml 在虚拟主机位置有变量名而不是值。
我在吠叫错误的树吗?
谢谢,
埃里克