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.
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:
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.
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:
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.
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.