原文地址:http://stackoverflow.com/questions/34916981/build-spring-framework-source-code-encounter-an-error
:spring-webmvc-portlet:sourcesJar UP-TO-DATE :spring-webmvc-tiles2:javadoc SKIPPED :spring-webmvc-tiles2:javadocJar SKIPPED :spring-webmvc-tiles2:sourcesJar SKIPPED :spring-websocket:javadoc UP-TO-DATE :spring-websocket:javadocJar UP-TO-DATE :spring-websocket:sourcesJar UP-TO-DATE :distZip FAILURE: Build failed with an exception. * What went wrong: Failed to capture snapshot of input files for task 'distZip' during up-to-date c heck. See stacktrace for details. > java.io.FileNotFoundException: C:\Users\yuqing\workspace\spring-framework\buil d\distributions\spring-framework-4.3.0.BUILD-SNAPSHOT-schema.zip * Try: Run with --info or --debug option to get more log output. * Exception is: org.gradle.api.UncheckedIOException: Failed to capture snapshot of input files f or task 'distZip' during up-to-date check. See stacktrace for details. at org.gradle.api.internal.changedetection.rules.TaskUpToDateState.<init >(TaskUpToDateState.java:60) at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactSt ateRepository$TaskArtifactStateImpl.getStates(DefaultTaskArtifactStateRepository .java:132) at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactSt ateRepository$TaskArtifactStateImpl.isUpToDate(DefaultTaskArtifactStateRepositor y.java:70) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.exec ute(SkipUpToDateTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execut e(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecu ter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
运行在windows上需要修改build.gradle文件,如下:
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)) } assert xsdFile != null into (shortName) { from xsdFile.path } } } }
替换成:
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 } } } }
mark..