How to Configure Eclipse to Work with `ehcache`

后端 未结 2 946
感动是毒
感动是毒 2020-12-21 11:30

Summary/Question

I\'ve rolled onto a project that uses ehcache. The project is maven enabled and when I run mvn clean install

相关标签:
2条回答
  • 2020-12-21 12:14

    Looks like current versions of NetBeans and IntelliJ aren't as strict on checking things as eclipse is. :) The following is what I found out.

    From ehcache with Spring. google code xsd file not found I found out that the top error was related to the fact that the xsd is no longer hosted at the url provided.

    Doing some googles, I found a reference to the version on github at: https://raw.githubusercontent.com/agentgt/ehcache-spring-annotations/master/core/src/main/resources/com/googlecode/ehcache/annotations/ehcache-spring-1.2.xsd by changing my bottom xsi schemalocation to the above url, it resolved the issue in eclipse.

    The stack overflow questions referenced, also provides a link to the google code archive of: https://code.google.com/archive/p/ehcache-spring-annotations/source/default/source

    If you download the zip, you can then find the offical xsd in the zip at: /schema/ehcache-spring/ehcache-spring-1.2.xsd (it also has ehcache-spring-1.0.xsd and ehcache-spring1.1.xsd in case anyone else has issues with even earlier versions).

    I found a way to reference the local schema file here: How to reference a local XML Schema file correctly?

    I'm going to post a question on how to reference it from a relative path of the project, as we have both windows and mac developers on this project. If this is of use to you, the details will be here: How to Reference Local XSD File By Relative Path

    0 讨论(0)
  • 2020-12-21 12:21

    Summary of issue:

    xsi-schemaLocation reference:

    http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd

    results in validation-issues in eclipse, on commandline maven there are no issues.

    replacing the ref with:

    https://raw.githubusercontent.com/agentgt/ehcache-spring-annotations/master/core/src/main/resources/com/googlecode/ehcache/annotations/ehcache-spring-1.1.xsd

    solves issue in eclipse. In maven the saxparser will complain however if you 're not connected to internet. By putting a proxy ref : -Dhttp.proxyHost=[proxyhost] -Dhttp.proxyPort=[proxyport] -Dhttps.proxyHost=[proxyhost] -Dhttps.proxyPort=[proxyport] the maven build succeeds....

    I investigated this difference in behaviour: in the ehcache-spring jar, ehcache-spring-annotations-1.1.2.jar, a META-INF/spring.schemas file is present.

    Content of that file: http\://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.0.xsd=com/googlecode/ehcache/annotations/ehcache-spring-1.0.xsd http\://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd=com/googlecode/ehcache/annotations/ehcache-spring-1.1.xsd

    cmdline maven uses this content (and finds the xsd in the jar). eclipse does not.

    Solution I used: go to eclipse preferences, XML -> XML Catalog and add a new user entry:

    Location: https://raw.githubusercontent.com/agentgt/ehcache-spring-annotations/master/core/src/main/resources/com/googlecode/ehcache/annotations/ehcache-spring-1.1.xsd

    Key type: Public id

    Key: http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd

    Alternative web adress: https://raw.githubusercontent.com/agentgt/ehcache-spring-annotations/master/core/src/main/resources/com/googlecode/ehcache/annotations/ehcache-spring-1.1.xsd

    Re-validating spring context files solved issues in my eclipse workspace.

    I like this solution better because it is a shortcoming of eclipse which i solve with an eclipse-specific solution.

    0 讨论(0)
提交回复
热议问题