解决 gradle 依赖项期间的 Eclipse 错误

Eclipse error during resolving gradle dependency

我已将依赖项 com.sun.mail:javax.mail:1.5.4 添加到 build.gradle,但 Eclipse 未解析此依赖项并抛出此错误

Illegal entry in Gradle Dependencies: D:/Programs/Eclipse/unresolved dependency - com.sun.mail javax.mail 1.5.4 PluginName      Unknown org.springsource.ide.eclipse.gradle.core.classpathcontainer

我多次尝试清理并重建项目,刷新依赖项,但仍然出现相同的错误,并且依赖项没有下载。有什么问题吗?

我的 build.gradle 文件:

apply plugin: 'java'
apply plugin: 'eclipse'

sourceCompatibility = 1.7
targetCompatibility = 1.7
version = '1.0'

jar {
    manifest {
        attributes 'Implementation-Title': 'PluginName',
               'Implementation-Version': version
    }
}

repositories {
    mavenCentral()
    maven {
        name 'Sponge maven repo'
        url 'http://repo.spongepowered.org/maven'
    }
}

dependencies {
    compile 'org.spongepowered:spongeapi:2.1-SNAPSHOT'
    compile 'com.sun.mail:javax.mail:1.5.4'
}

test {
    systemProperties 'property': 'value'
}

uploadArchives {
    repositories {
        flatDir {
            dirs 'repos'
        }
    }
}

我完全不知道为什么,但它开始工作并且刚刚下载了依赖项。