win10下手动编译Spring

在windows下执行gradlew.bat build发生异常,如下:
image

原因是执行gradle编译时,没有生成xxx-schema.zip文件。

通过修改task schemaZip,将文件路径分符由Unix系统的/修改为windows系统的\\.

task schemaZip(type: Zip) {
	group = "Distribution"
	baseName = "spring-framework"
	classifier = "schema"
	description = "Builds -${classifier} archive containing all " +
			"XSDs for deployment at http://springframework.org/schema."
	duplicatesStrategy 'exclude'
	moduleProjects.each { subproject ->
		def Properties schemas = new Properties();

		subproject.sourceSets.main.resources.find {
			it.path.endsWith("META-INF\\spring.schemas")
		}?.withInputStream { schemas.load(it) }

		for (def key : schemas.keySet()) {
			def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
			assert shortName != key
			File xsdFile = subproject.sourceSets.main.resources.find {
				it.path.endsWith(schemas.get(key).replaceAll('\\/', '\\\\'))
			}
			assert xsdFile != null
			into (shortName) {
				from xsdFile.path
			}
		}
	}
}

参考stackoverflow


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!