maven spring - Cannot find the declaration of element 'beans' maven spring - Cannot find the declaration of element 'beans' spring spring

maven spring - Cannot find the declaration of element 'beans'


I know 2 situations where you can have this problem

  • If you don't have an internet connection (behind a proxy, for instance). In that case, download the XSD, copy it next to the XML, and change the schema location to xsi:schemaLocation=" http://www.springframework.org/schema/beans spring-beans-2.5.xsd ..."
  • If you have an internet connection / still have the problem, that's because you use different versions of Spring for the XSD and the jar.


I think the XSD would be part the spring jar, so shouldn't be issue.


Spring jars contain META-INF/spring.handlers and META-INF/spring.schemas files. To avoid overwriting the files when aggregating dependencies to one jar you can use maven Shade plugin:

http://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html#AppendingTransformer