Trouble compiling project with gradle

I am trying to build the jar files from the source files in my project using gradle, and I am running into trouble.

I am getting an error saying that the “Package does not exist” for any classes related to the JME Terrain classes. It seems like it is a problem with my dependencies, but I am also very inexperienced with grale, and this is the first time I’ve attempted to correctly setup the repository and build files for a project of my own.

Here are the errors I get when it tries to compile. It looks the error originates from importing the Terrain classes

Task :compileJava FAILED
C:\Users\ryan\Desktop\DecalMonkey\src\main\java\com\aaaaGames\decalMonkey\DecalE
nabledMap.java:10: error: package com.jme3.terrain does not exist
import com.jme3.terrain.Terrain;
^
C:\Users\ryan\Desktop\DecalMonkey\src\main\java\com\aaaaGames\decalMonkey\DecalE
nabledMap.java:20: error: cannot find symbol
public ArrayList getTerrains();
^
symbol: class Terrain
location: interface DecalEnabledMap
C:\Users\ryan\Desktop\DecalMonkey\src\main\java\com\aaaaGames\decalMonkey\Textur
eEffectManagerState.java:26: error: package com.jme3.terrain does not exist
import com.jme3.terrain.Terrain;
^
C:\Users\ryan\Desktop\DecalMonkey\src\main\java\com\aaaaGames\decalMonkey\Textur
eEffectManagerState.java:27: error: package com.jme3.terrain.geomipmap does not
exist
import com.jme3.terrain.geomipmap.TerrainPatch;
^
C:\Users\ryan\Desktop\DecalMonkey\src\main\java\com\aaaaGames\decalMonkey\Textur
eEffectManagerState.java:28: error: package com.jme3.terrain.geomipmap does not
exist
import com.jme3.terrain.geomipmap.TerrainQuad;
^
C:\Users\ryan\Desktop\DecalMonkey\src\main\java\com\aaaaGames\decalMonkey\Textur
eEffectManagerState.java:64: error: cannot find symbol
private ArrayList terrains;
^
symbol: class Terrain
location: class TextureEffectManagerState
C:\Users\ryan\Desktop\DecalMonkey\src\main\java\com\aaaaGames\decalMonkey\Textur
eEffectManagerState.java:591: error: cannot find symbol
private void findTerrainPatches(Node node, ArrayList store, B
oundingVolume bounds){
^
symbol: class TerrainPatch
location: class TextureEffectManagerState
C:\Users\ryan\Desktop\DecalMonkey\src\main\java\com\aaaaGames\decalMonkey\Textur
eEffectManagerState.java:202: error: cannot find symbol
ArrayList terrainPatches = getTerrainPatches(bounds);
^
symbol: class TerrainPatch
location: class TextureEffectManagerState
C:\Users\ryan\Desktop\DecalMonkey\src\main\java\com\aaaaGames\decalMonkey\Textur
eEffectManagerState.java:381: error: cannot find symbol
for(TerrainPatch patch : terrainPatches){
^
symbol: class TerrainPatch
location: class TextureEffectManagerState
C:\Users\ryan\Desktop\DecalMonkey\src\main\java\com\aaaaGames\decalMonkey\Textur
eEffectManagerState.java:575: error: cannot find symbol
for(Terrain terrain : terrains){
^
symbol: class Terrain
location: class TextureEffectManagerState
C:\Users\ryan\Desktop\DecalMonkey\src\main\java\com\aaaaGames\decalMonkey\Textur
eEffectManagerState.java:595: error: cannot find symbol
if(spatial instanceof TerrainPatch){
^
symbol: class TerrainPatch
location: class TextureEffectManagerState
C:\Users\ryan\Desktop\DecalMonkey\src\main\java\com\aaaaGames\decalMonkey\Textur
eEffectManagerState.java:596: error: cannot find symbol
if(((TerrainPatch)spatial).getWorldBound().intersects(bounds)){
^
symbol: class TerrainPatch
location: class TextureEffectManagerState
C:\Users\ryan\Desktop\DecalMonkey\src\main\java\com\aaaaGames\decalMonkey\Textur
eEffectManagerState.java:597: error: cannot find symbol
store.add((TerrainPatch) spatial);
^
symbol: class TerrainPatch
location: class TextureEffectManagerState
C:\Users\ryan\Desktop\DecalMonkey\src\main\java\com\aaaaGames\decalMonkey\Textur
eEffectManagerState.java:600: error: cannot find symbol
else if(spatial instanceof Node || spatial instanceof TerrainQuad){
^
symbol: class TerrainQuad
location: class TextureEffectManagerState
Note: C:\Users\ryan\Desktop\DecalMonkey\src\main\java\com\aaaaGames\decalMonkey
TextureEffectManagerState.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
14 errors

Here is the link to my build.gradle file on github

Is there a separate dependency I need to reference for the terrain classes, or is there something else I’m doing wrong?

I’m still learning mostly everything when it comes to gradle, so any help or advice is appreciated

Edit: I should also note, I setup my gradle.build based on the the SimArboreal project as my reference, since the most experience I have with gradle was building that project from the sources in the past.

If you want to use JME’s terrain then you will need to include the terrain dependency.

These are all of the different public JME dependencies that you can depend on:

Edit: note that you are also missing the natives, etc… you should either base it on the SimArborealEditor and not just SimArboreal… or you can just use the sample build here:

…which is the most basic JME example possible.

1 Like