這是一個跟進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