Spring and maven class library and accessing xml file

时间:2017-08-04 13:02:50

标签: java spring eclipse maven tomcat

I have 2 Maven projects. One of them is using Spring, other one is a class library that has an xml file and a class file that uses this xml file. In the Spring project, I call the class then I got an error:

"I am not found the xml file"

This xml file is unimportant for the Spring project. Because it's in the class library project, I don't want to access the xml file directly, I just want to call the classes and the classes access the xml file.

Why did this happen? And what is the solution?

Tomcat: 9

IDE: Eclipse

Note: There is no problem when any classes in class library wants to access the xml file

Thanks for helping.

2 个答案:

答案 0 :(得分:1)

为此,您必须配置为基于Java的项目。否则,它将首先加载XML文件。

答案 1 :(得分:0)

我找到了解决方案。我将xml文件复制到spring项目,作为maven存储库中的相同文件夹名称。它有效,但我不明白为什么我必须这样做:))