这是一个跟进How to Configure Eclipse to Work with `ehcache`并有绝对路径的How to reference a local XML Schema file correctly?如何引用本地XSD文件通过相对路径
为例由于xsd
文件不再主持过程中,我下载了一个副本来自档案。我已将该文件放在我的资源目录中,并希望从我的项目的相对路径中的xsi:schemaLocation
中引用它。我们有Windows和Mac开发人员,因此像file:///c:/project/foo
这样的绝对路径约定将不起作用。
另一种相对路径的替代方法是,如果有一种方法可以引用windows和mac的系统属性,那么我可以做2个条目,如file:///$HOME/workspace/foo
。
我在我的Mac上的项目存在于~/workspace/foo
和$ HOME的回声给我的家乡道路。
我spring-cache.xml
存在./src/main/webapp/WEB-INF/spring/
我ehcache-spring-1.2.xsd
存在./src/main/resources/
下面是一些我没有成功尝试:
file:///$HOME/workspace/foo/src/main/resources/ehcache-spring-1.2.xsd
file:///./src/main/resources/ehcache-spring-1.2.xsd
file:///../../../../resources/ehcache-spring-1.2.xsd
file:///../../../../resources/ehcache-spring-1.2.xsd
../../../../resources/ehcache-spring-1.2.xsd
file://../../../../resources/ehcache-spring-1.2.xsd
file://$HOME/workspace/foo/src/main/resources/ehcache-spring-1.2.xsd
file://./src/main/resources/ehcache-spring-1.2.xsd
file://../../../../resources/ehcache-spring-1.2.xsd
我似乎也有它越来越来的问题也从绝对路径引用文件,所以也许有不同的方式来引用mac上的文件?例如以下没有工作:
file:///Users/me/workspace/foo/src/main/resources/ehcache-spring-1.2.xsd
file:////Users/me/workspace/foo/src/main/resources/ehcache-spring-1.2.xsd
file://Users/me/workspace/foo/src/main/resources/ehcache-spring-1.2.xsd