Проблема с classpath: Gradle не работает

1

Uinsg Gradle на Netbeans 8.02:

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

Так

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

Производит ошибку

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

Как можно исправить эту ошибку?

Изменение: Файл сборки 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
    Можете ли вы показать нам свой файл сборки Gradle?
  • 0
    @ Александр готов!
Показать ещё 1 комментарий
Теги:
maven
gradle
netbeans
jar

1 ответ

1
Лучший ответ

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

Ещё вопросы

Сообщество Overcoder
Наверх
Меню