如何使用Gradle在Gluon Project中设置JUnit测试 [英] How to setup JUnit testing in Gluon Project with Gradle
问题描述
我的build.gradle文件如下所示:
buildscript {
repositories {
jcenter()
}
依赖关系{
classpath'org.javafxports:jfxmobile-plugin :1.0.0-b10'
}
}
应用插件:'org.javafxports.jfxmobile'
库(
jcenter ()
}
依赖关系{
compile'com.gluonhq:ignite-dagger:1.0.0'
compile'org.elasticsearch:elasticsearch:1.6.0 '
compile'ch.qos.logback:logback-classic:1.1.5'
testCompile'junit:junit:4.12'
}
mainClassName ='com .me.MyApplication'
jfxmobile {
android {
manifest ='src / android / AndroidManifest.xml'
}
ios {
infoPList = file('src / ios / Default-Info.plist')
}
}
解析依赖关系是没有问题的,但运行'test'任务时,gradle会抛出如下错误:
当使用java 8运行gradle时,必须使用属性retrolambda.oldJdk或环境变量JAVA6_HOME / JAVA7_HOME
将路径设置为旧的jdk无法使用Gradle分发 https://services.gradle.org/distributions/gradle-2.2.1-all。 zip '。
我已经尝试根据插件的 README 在GitHub上,但到目前为止还没有工作。有人可以告诉我如何配置我的Gluon项目,以便我能够使用Gradle运行我的JUnit测试?
一些重要的加法: $ b对于插件版本,它说:Gluon Tools 1.0.0.201508201514
我认为我想说我想要使用匕首依赖注入与Gluon Ignite,这可能是我的情况下真正的问题,因为它需要Java 8,并可能与javafxports或其他内容相冲突。但是,我无法充分了解我看到的各种错误信息。
我的测试是空的,但是它们甚至没有运行,因为它以前失败。
你的问题似乎像 retrolambda配置问题。如果您浏览插件的配置页面,它指出,如果您没有为 JAVA6_HOME
或 JAVA7_HOME
设置环境变量,而不需要显式定义 oldJdk
让插件正常工作。
I am trying to setup JUnit testing in my Gluon JavaFX Application. I am using the Gluon Eclipse Plugin with Gradle and Java 8.
My build.gradle file looks like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.0.0-b10'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
}
dependencies {
compile 'com.gluonhq:ignite-dagger:1.0.0'
compile 'org.elasticsearch:elasticsearch:1.6.0'
compile 'ch.qos.logback:logback-classic:1.1.5'
testCompile 'junit:junit:4.12'
}
mainClassName = 'com.me.MyApplication'
jfxmobile {
android {
manifest = 'src/android/AndroidManifest.xml'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
}
}
Resolving the dependency is no problem, but when running the 'test' task, gradle throws an error like this:
When running gradle with java 8, you must set the path to the old jdk, either with property retrolambda.oldJdk or environment variable JAVA6_HOME/JAVA7_HOME Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.2.1-all.zip'.
I already tried to add the retrolambda plugin to gradle according to the plugin's README on GitHub, but it doesn't work so far. Could someone tell me what to do to configure my Gluon project so that I am able to run my JUnit tests with Gradle?
Some important addidtions:
For the plugin version it says: Gluon Tools 1.0.0.201508201514
I think I fogot to mention that I want to use Dagger dependency injection with Gluon Ignite which might be the real problem in my case as it requires Java 8 and might conflict with javafxports or something else. However, I'm not able to make full sense of the various error messages I've seen.
My tests are empty, but they aren't even run, because it fails before.
Your problem seems like a retroLambda configuration issue. If you go through the configuration page for the plugin, it states that if you don't have an environment variable set for JAVA6_HOME
or JAVA7_HOME
than you need to explicitly define oldJdk
for the plugin to work properly.
这篇关于如何使用Gradle在Gluon Project中设置JUnit测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!