我希望在开发中运行mvn test
和文件支持的数据库时在内存数据库中使用。我有过滤器"工作"因为我运行mvn resources:resources
我将src/main/resources
中的模板正确呈现到target/classes
目录中。在我的Main类中使用Grizzly,网络服务器确实在hibernate.cfg.xml
中获取了target/classes
。
但是,当我运行mvn test
时,似乎hibernate.cfg.xml
被视为src/main/resources
中的原始模板,而不是target/classes
中呈现的内容。如何获取mvn test
(以及从intellij运行测试)以使用过滤/渲染资源?
答案 0 :(得分:4)
将测试配置文件放在src/test/resources
中,所以在test
时它将优先(在类路径中)