属性文件中的占位符未在目标中被maven替换 [英] Placeholders in properties file are not replaced in target by maven
本文介绍了属性文件中的占位符未在目标中被maven替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个filter.properties文件,其中包含以下内容:
I have a filter.properties file that contains the following :
database.driver= mydatabase
database.url= myURL
database.user=usr
database.password=pwd
database.initialsize=3
database.maxactive=5
我的openejb.xml文件中的Resource标签中也有此标签:
I also have this in my openejb.xml file in a Resource tag :
JdbcDriver ${database.driver}
JdbcUrl ${database.url}
UserName ${database.user}
Password ${database.password}
但是当我执行tomee:maven运行时,会出现大量此类错误:
But when I do a tomee:run with maven I get a ton of errors of this type :
Unable to resolve class ${database.driver}
OR
Caused by: java.lang.ClassNotFoundException: ${database.driver}
我试图通过添加pom.xml来解决该问题:
I've tried to counter the problem by adding in my pom.xml :
<properties>
<myDatabase.driver>${database.driver}</myDatabase.driver>
</properties>
但这没用.
欢迎所有建议.
最诚挚的问候.
推荐答案
<filtering>true</filtering>
这假定所有内容都是资源,位于类路径上.
This assumes everything is a resource, file on the class path.
或者在Tomcat中的应用程序外部创建这样的数据源.
Alternatively create such a data source outside of the application in Tomcat.
这篇关于属性文件中的占位符未在目标中被maven替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文