Skip to content

'gradle run' fails in simple-jme. A hackers fix is included. #11

@tdhargraves

Description

@tdhargraves

I decided to try and learn Gradle
Simcilica simple-jme seemed to be touted as the 'one-to-use'
I downloaded Simcilica/Examples and tried a 'gradle run' in simple-jme.
Gradle run failed at the line starting "task wrapper".
The error log suggested I upgrade gradle.
I was using Gradle 5.1.1, so I rapidly upgraded to the latest 6.5.1.
I got even more errors :-(

Seems the gradle renamers have been in action.
compile has been replaced by implementation
runtime by runtimeOnly.
These kinds of changes are great for the humble software engineer.
Employment forever...

So I hacked build.gradle so it works with Gradle 6.5.1 and simple-jme.
I simply delete the task wrapper statement. (?).
I used @sgold Stephen Gold's Minie project as a more recent example.
(I added the snippet from his gradle files to reduce warnings).

Please understand that yesterday I knew nothing about gradle.
Now I know about 0.001%

-----------------------------oOo--------------------------------

apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'idea'

mainClassName='mygame.Main'
	
repositories {
    jcenter()
}

ext.jmeVersion = "[3.3,)" 

project(":assets") {
    apply plugin: "java"
    
    buildDir = rootProject.file("build/assets")
    
    sourceSets {
        main {
            resources {
                srcDir '.'
            }
        }
    }    
}

dependencies {

    implementation "org.jmonkeyengine:jme3-core:$jmeVersion"
    implementation "org.jmonkeyengine:jme3-desktop:$jmeVersion"
    
    // select one version of LWJGL
    runtimeOnly "org.jmonkeyengine:jme3-lwjgl:$jmeVersion"  // LWJGL 2.x
    //runtimeOnly "org.jmonkeyengine:jme3-lwjgl3:$jmeVersion" // LWJGL 3.x

    // Include these to avoid warnings from AssetConfig.
    runtimeOnly "org.jmonkeyengine:jme3-blender:$jmeVersion"
    runtimeOnly "org.jmonkeyengine:jme3-jogg:$jmeVersion"
    runtimeOnly "org.jmonkeyengine:jme3-plugins:$jmeVersion"

    runtimeOnly project(':assets')    
}

task createDirs {
    
    def pkg = 'mygame'
    def dirs = [
        file("./src/main/java/$pkg"),
        file("./src/main/resources"),
        file("./assets/Interface"),
        file("./assets/MatDefs"),
        file("./assets/Materials"),
        file("./assets/Models"),
        file("./assets/Scenes"),
        file("./assets/Shaders"),
        file("./assets/Sounds"),
        file("./assets/Textures"),    
    ]
    
    dirs.each {
        if( !it.exists() ) {
            println "Creating " + it
            it.mkdirs()
        }
        if( it.listFiles().length == 0 ) {
            def stub = new File(it, 'removeme.txt') 
            println "Creating stub file to allow git checkin, file:$stub"
            stub.text = "Remove me when there are files here."
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions