2016-09-26 155 views
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查看我的依賴關係?

回答

0

爲了使NetBeans能夠在build.gradle中找到所做的更改,您必須單擊「Reload project」(在項目的上下文菜單中)。

+0

猜對了 – TooLazy