天天看点

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.

继续阅读