这是对
How to Configure Eclipse to Work with `ehcache`的跟进,并且在
How to reference a local XML Schema file correctly?中有一个绝对路径的例子
由于不再托管xsd文件,我从存档中下载了它的副本.我把文件放在我的资源目录中,并希望从我项目的相对路径中的xsi:schemaLocation中引用它.我们有windows和mac开发人员,因此像file:/// c:/ project / foo这样的绝对路径约定将不起作用.
相对路径的另一种替代方法是,如果有一种方法可以引用windows和mac的系统属性,那么我可以执行2个条目,如file:/// $HOME / workspace / foo.
我的mac上的项目存在于〜/ workspace / foo中,$HOME的echo给出了我的主路径.
我的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