简体   繁体   中英

NetBeans Gradle project

I have just created empty Gradle project in NetBeans 8.0.2 and trying to add rxjava dependency. Here's my build.

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')
}

But in my main class i cant use rx.* classes. Even after downloaded and imported .jar file NetBeans cant find em. Where am i wrong? In android studio i need just to add gradle dependencies and its ok. Here not. How can i make NetBeans see my dependencies via gradle?

您必须单击“重新加载项目”(在项目的上下文菜单中),以便NetBeans可以在build.gradle中进行更改。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM