1. 程式人生 > >spring用gradle匯入eclipse時異常導致失敗

spring用gradle匯入eclipse時異常導致失敗

一、出現的異常

FAILURE: Build failed with an exception.



* What went wrong:
Execution failed for task ':spring-webmvc-tiles3:eclipseClasspath'.
> Could not resolve all dependencies for configuration 'detachedConfiguration2'.


   > Module version org.springframework:spring-webmvc-tiles3:4.0.0.M3, configura
tion 'detachedConfiguration2' declares a dependency on configuration 'runtimeMer
ge' which is not declared in the module descriptor for org.springframework:sprin
g-web:4.0.0.M3


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.


BUILD FAILED

二、解決辦法

1、在spring主目錄下找到build.gradle檔案,用ultraEdit開啟;

2、找到project("spring-webmvc-tiles3"),並在結尾處新增如下部分並儲存。

eclipseClasspath {
       downloadSources = false; // required for eclipseClasspath to work
}

3、在cmd命令列中,重新執行命令gradle eclipse -x:eclipse.