Witam,
Ściągnąłem libgtx która jest zapisana jako projekt w Gradle. Zainstalowałem wtyczkę do Netbeans i otworzyłem projekt. Wszystko ok, do czasu kiedy chciałem dodać bibliotekę lib.jar. Nie wiem jak to zrobić. W opcjach projektu nie ma opcji "dodaj lib .jar" , a gradle nie umiem kompletnie obsługiwać.
Wrzucałem lib.jar do folderu libs i dodawałem linię: ale rzucało błędami.
compile files ('libs/RXTXcomm.jar')
compile fileTree(dir: 'libs', include: '*.jar') //lub bez
bulid.gradle[test]
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = 'kostka'
gdxVersion = '1.0.0'
roboVMVersion = '0.0.11'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
}
project(":desktop") {
apply plugin: "java"
dependencies {
compile project(":core")
compile files ('libs/RXTXcomm.jar') //--stacktrace
//compile fileTree(dir: 'libs', include: '*.jar')
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
}
}
tasks.eclipse.doLast {
delete ".project"
}
bulid.gradle[desktop]
apply plugin: "java"
sourceCompatibility = 1.6
sourceSets.main.java.srcDirs = [ "src/" ]
project.ext.mainClassName = "com.mygdx.game.desktop.DesktopLauncher"
project.ext.assetsDir = new File("../core/assets");
task run(dependsOn: classes, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
workingDir = project.assetsDir
ignoreExitValue = true
}
task dist(type: Jar) {
from files(sourceSets.main.output.classesDir)
from files(sourceSets.main.output.resourcesDir)
from {configurations.compile.collect {zipTree(it)}}
from files(project.assetsDir);
manifest {
attributes 'Main-Class': project.mainClassName
}
}
dist.dependsOn classes
eclipse {
project {
name = appName + "-desktop"
linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/core/assets'
}
}
task afterEclipseImport(description: "Post processing after project generation", group: "IDE") {
doLast {
def classpath = new XmlParser().parse(file(".classpath"))
new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]);
def writer = new FileWriter(file(".classpath"))
def printer = new XmlNodePrinter(new PrintWriter(writer))
printer.setPreserveWhitespace(true)
printer.print(classpath)
}
}
Proszę o pomoc.