[SOLVED] How do I use jme3-testdata in Basic Gradle Game?

I create a File > New Project > JME3 > Basic Gradle Game. It runs fine. I try to add a Texture to the Material:

        Material floorMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        floorMat.setTexture("ColorMap", assetManager.loadTexture("Textures/Terrain/BrickWall/BrickWall.jpg"));

It fails to run, as expected because I don’t have jme3-testdata.jar. I see that it is in my installation as C:/Program Files/jmonkeyplatform/jmonkeyplatform/libs/jme3-testdata.jar
So I go to Build Scripts > build.gradle and hope to add it in, not knowing Gradle.
I try various implementation lines like the ones generated for me:

  implementation "org.jmonkeyengine:jme3-core:$jmeVer"
  implementation "org.jmonkeyengine:jme3-testdata:$jmeVer" // e.g.
  implementation "org.jmonkeyengine:jme3-testdata:" // e.g.
  implementation "org.jmonkeyengine:jme3-testdata" // e.g.
  implementation "org.jmonkeyengine:jme3-testdata.jar" // e.g.
  implementation "{absolute-path}/jme3-testdata" // e.g.
  implementation "{absolute-path}/jme3-testdata.jar" // e.g.

But my source immediately crys, saying it can find NO com.{anything}, when I have my invalid line in it. Maybe I’ve got the syntax wrong? Maybe I need to modify other files. ( I can’t even understand why jme3-core:$jmeVar works when $jmeVer is 3.3.0-stable and the file is actually jm3-core-3.3.0-stable but the string doesn’t have that last dash in it! )

I added jme3-testdata.jar to the HelloTerrain ANT build example, and that worked. Would you tell me how to do it for Gradle? Before I go trying to build my own assets, I’d just like to use the testdata assets and get some custom examples working first.

1 Like

I believe your best solution would be something like this:

    runtimeOnly 'org.jmonkeyengine:jme3-testdata:3.4.0-stable'

Note ‘3.4’ instead of ‘3.3’. Unfortunately jme3-testdata-3.3.0-stable isn’t available from MavenCentral. If you really want that version, you’ll need to download it to your build system and do something like this:

    runtimeOnly files('libs/jme3-testdata-3.3.0-stable.jar')

To see all versions at MavenCentral:


1 Like

I was able to do:

implementation files('C:/Program Files/jmonkeyplatform/jmonkeyplatform/libs/jme3-testdata.jar')

and it worked. I’ll look at getting project-local libraries and later project-local assets.

1 Like

The answer to your question:

I downloaded v3.3.0-stable because that is the latest one listed in https://github.com/jMonkeyEngine/sdk/releases
I haven’t worked with Maven since the JME SDK has only a “BasicGame” and a “Basic Gradle Game” project template and not a Maven template.

1 Like

The latest JMonkeyEngine SDK release is version 3.3, but the latest Engine release is version 3.4. While there’s no SDK release that includes the 3.4 Engine libraries, if you build using Gradle, you can use the latest version of the Engine very easily.

Gradle understands Maven artifacts very well. That’s why the easiest way to build JME apps using Gradle is to point Gradle at the MavenCentral repo, like so:

repositories {

Great! (Just for other noobs encountering this…)

  • I changed the repositories section to mavenCentral(). Then my source couldn’t understand any com. reference.
  • I changed the project.ext section to say jmeVer = ‘3.4.0-stable’.
  • I went to the project’s Configurations section, right-clicked, and chose “Download Sources”.
  • {chug, chug, chug}
  • I saw under Configurations > compileClasspath that all the libraries said ‘3.4.0-stable’
  • {chug, chug, chug}
  • When it stopped, all my sources understood com. references again!
  • And it ran! (though it reset my fullscreen setting to windowed)
  • I’ll do Configurations > {right-click} “Download Javadoc” now

And, @sgold’s point about the SDK being 3.3 but the Engine being 3.4 explains my other thread question about how to upgrade 3.3 to 3.4 :sunglasses: Thanks!

1 Like

@fba, I see how the Basic Gradle Game’s template for build.gradle has

project.ext {
  jmeVer = '3.3.0-stable'
dependencies {
  implementation "org.jmonkeyengine:jme3-core:$jmeVer"

and how your suggestion defines both the prefix and suffix of the libraries to make it more modular. Thanks!

1 Like

I’m glad you’re back on track!

And you can add to build.gradle like:

dependencies {
    implementation fileTree(dir: 'lib', include: ['*.jar'])

That will scan all the JARs you added on your project manually. But that is really a thing of the past. Of course if the said resource pre-dates dinosaurs, there is no other option. And it does work.

1 Like

I saw a [SOLVED] on my thread. How do I mark a particular reply as [SOLVED]? I don’t want to bother admins/etc having to figure which post answered the question.

Just edit the thread title and add a [SOLVED] to it.


I haven’t encountered a forum that lets you edit thread titles.