0
我刚刚在NetBeans 8.0.2中创建了空的Gradle项目,并尝试添加rxjava依赖项。这是我的构建。NetBeans Gradle项目
apply plugin: 'java'
apply plugin: 'application'
mainClassName = "newpackage.main"
sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
// NetBeans will automatically add "run" and "debug" tasks relying on the
// "mainClass" property. You may however define the property prior executing
// tasks by passing a "-PmainClass=<QUALIFIED_CLASS_NAME>" argument.
//
// Note however, that you may define your own "run" and "debug" task if you
// prefer. In this case NetBeans will not add these tasks but you may rely on
// your own implementation.
if (!hasProperty('mainClass')) {
ext.mainClass = 'newpackage.main'
}
repositories {
mavenCentral()
jcenter()
// You may define additional repositories, or even remove "mavenCentral()".
// Read more about repositories here:
// http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:repositories
}
dependencies {
// TODO: Add dependencies here ...
// You can read more about how to add dependency here:
// http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:how_to_declare_your_dependencies
testCompile group: 'junit', name: 'junit', version: '4.10'
compile 'io.reactivex:rxjava:1.2.0'
runtime files('libs/rxjava-1.2.0.jar')
}
但是在我的主类中,我不能使用rx。*类。即使在下载并导入.jar文件后,NetBeans也无法找到它们。我在哪里错了?在android工作室我只需要添加gradle依赖和它的好。这里不是。我如何让NetBeans通过gradle查看我的依赖关系?
猜对了 – TooLazy