我正在开发Gradle项目。当我做gradle run
时,该项目下载依赖项并运行得非常好。这里是我的build.gradle文件:Intellij IDEA无法导入Gradle项目 - “无法初始化类javax.crypto.SunJCE_b”
buildscript {
repositories {
mavenCentral()
}
dependencies {
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'application'
mainClassName = 'myProject.MyMainClass'
repositories {
mavenCentral()
}
dependencies {
// The production code uses the SLF4J logging API at compile time
compile 'org.slf4j:slf4j-api:1.7.7'
compile 'org.jsoup:jsoup:1.7.2'
testCompile "junit:junit:4.11"
}
jar {
baseName = 'myproject-service'
version = '0.1.0'
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
现在我想在Intellij IDEA中导入项目。
进口摇篮工程>>使用默认gradle这个包装(推荐)>> OK
然而,当我点击确定其与对话来了说:
无法初始化类javax.crypto.SunJCE_b
寻找在日志中,它说
org.gradle.tooling.GradleConnectionException: Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.3-bin.zip'.
...
Caused by: java.lang.NoClassDefFoundError: Could not initialize class javax.crypto.SunJCE_b
at javax.crypto.KeyGenerator.a(DashoA13*..)
...
2015-03-18 21:31:17,751 [2354198] WARN - nal.AbstractExternalSystemTask - Could not initialize class javax.crypto.SunJCE_b
com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not initialize class javax.crypto.SunJCE_b
at org.jetbrains.plugins.gradle.service.project.AbstractProjectImportErrorHandler.createUserFriendlyError(AbstractProjectImportErrorHandler.java:106)
...
我不知道如何让这个项目工作。如果没有这一点,我的任何从外部存储库导入的内容都不能在IDEA内工作(它们全都显示为红色)。任何帮助,将不胜感激。我在:
- 的IntelliJ IDEA 13.1.6
- 的Java EE 7(jdk1.7.0_75.jdk)
- 摇篮2.3
- 的Mac OS X
在升级到2016.3之后,也出现了与maven相同的问题 - 使用本地安装的maven而不是捆绑版本修复了我的问题。 数字吻接你的方式! <3 – 2017-01-12 13:55:17