2015-03-23 2 views
1

Uinsg Gradle на Netbeans 8.02:Classpath вопрос: Gradle не работает

Получение ошибки компиляции Java относительно дополнительных библиотек не автоматически добавляются в путь к классам.

Так

import org.apache.poi.hssf.usermodel.HSSFCell; 

Выдает ошибку

пакет org.apache.poi.hssf.usermodel не существует

Как можно идти об исправлении этой ошибки?

Edit: Gradle построить файл:

apply plugin: 'java' 

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

repositories { 
    mavenCentral() 
    // 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' 
} 
+0

Можете ли вы показать нам файл с градиентом сборки? – Alexander

+0

@Alexander сделано! – Stumbler

+0

Похоже, вы должны исправить вас. // TODO: Добавить зависимости здесь ... '. См. Ответ @ tinker – Alexander

ответ

1

Вам нужно добавить зависимость библиотеки в ваших 'компилировать' требований. Подробнее о зависимостях here. Зависимости можно найти в общедоступных хранилищах Maven, или вы можете добавить свои собственные, если у вас есть пользовательское репо.

Смежные вопросы