How to Gradle...? Using the JME SDK

Hi,

we have a pretty standard JME project. We already have support for Gradle. But unfortunately the project when opened with JME SDK (or Netbeans), it isn’t a Gradle project. I have the Gradle plugin installed in JME SDK. Now what are my options? JME produces the ant build.xml which I would like to use.

JME itself is a multiproject Gradle project. I can also create a something called Single Gradle project, which I think is the one I want. But every time I try to convert the project, I loose the JME build and NB settings such as the run profiles/configurations. Has anyone got a good example or advice?

1 Like

Theres two ways: Either you use the ANT project with the SDK features or you make your own gradle project without the SDK features. You could call the ANT build file from a gradle project which would be rather silly I guess because you still don’t use gradle features for the project then.

So I can’t have both really then, that simple… Makes sense.

i know its old topic, but about the question i need answer. so might refresh it.

To people who use gradle: how do you convert/preview/change models when use gradle?

as i see here, if using gradle then im unable to use ANY feature like conver model to j3o or manage j3o scene graph to fix converter scene graph in IDE.

If someone use gradle within SDK, then do you have some solution to maintain SDK features for assets?

im interested in quick solution for a fast asset managing(that i had in SDK). I seen there is some project also, but not sure how fast you can use it to just update one model(lets say convert from gltf to j3o + remove/move some of scenegraph elements). in SDK it was seconds for me. Having a lot of models will be pain if there are no good solution.

I have a regular SDK project so I can edit the assets and then just manually call ./gradlew run from the command line for gradle, but you could also use two IDEs then, the SDK for Model Editing and One for Gradle, possibly you could also just use two projects and copy the files back and forth.

I looked into the issue last year but I couldn’t get to even depend on the gradle plugin when creating a new SDK Module to the point where the Netbeans Guys were clueless as well…

hi @Darkchaos i know you alone with SDK develop right? (if its even still supported much)

i like SDK somehow, it is easy, everything in one place, could go other computer, install SDK, git clone project, and just work. quick work. also no worry about missing dependencies, different environment, etc etc.

just use two projects and copy the files back and forth.

This will slow the work. Often i need just check model changes insite game testFile(some special shaders, code model manipulation that scenegraph cant see). Anyway each convert(blend to j3o, ogre to j3o, gltf to j3o) each have different scenegraph… That why i liked using SDK for quick scenegraph fixes before checking inside game.

Im not against other solutions, i can not even use SDK, i just want quick tool/tools that will speed up work, not slow down.

But i seen a lot of discussion about like in:

install is just single action. Should be no problematic, but dont need to be easy.
Anyway tool/tools to make game should be fast, without bugs and help with programming.

**But back to topic. **

You say its possible with 2 IDE?

**i would rather ask question. Am i able to create Ant project with just Assets only. then i would do something like **
"runtime files("…/AntAssetProject/assets")" in gradle project that use this Assets.

Then i would be able to use both IDE tools for assets AND gradle project?

1 Like

I think i found solution myself.

  1. Create Ant project for just Assets
  2. Create gradle project for sources/libs/etc.
  3. in gradle dependencies add:
    runtime files("..//separateAntAssetsProject/assets")

Ready! Just Use SDK features for all Assets, while still same SDK you can modify gradle project.

@tonihele
and its not calling Ant build. (for development)
for production, will need different solution.

2 Likes

Well, if I may introduce some black magic to the mix, I currently have two projects being built together. One is the main gradle project, contains all code, and the other is a jme3 ant project, containing all the assets. I do this so I can still have my gradle project while still being able to use SDK asset tools. Plus it makes it easier to just pull the asset repo.

If your interested in this setup, follow this 3 step recipe:

In your main projects build.gradle, define a variable with the relative path to the ant asset project
def assetPack = "../Assets"

Then, right before the dependencies section of your build.gradle, prefix all the ant project tasks with “ant” to avoid task collision, and make gradle’s compilation depend on the ant projects jar output

ant.importBuild("${assetPack}/build.xml") { antTarget ->
    'ant-' + antTarget
}
compileJava.dependsOn "ant-jar"

Then, finally add the ant project build results to the gradle dependencies:

dependencies {
    implementation fileTree(dir: "${assetPack}/dist", include: "*.jar")
}

Now, anything in your ant project is available to your gradle project. This can be done with multiple ant projects as well, by repeating the 3 steps above, and changing the names such as:

`def assetPack = "../Assets"`
`def extraPack = "../Extra"
...
ant.importBuild("${assetPack}/build.xml") { antTarget ->
    'ant-' + assetPack+ '-' + antTarget
}
compileJava.dependsOn "ant-" + assetPack + "-jar"

ant.importBuild("${extraPack}/build.xml") { antTarget ->
    'ant-' + extraPack+ '-' + antTarget
}
compileJava.dependsOn "ant-" + extraPack + "-jar"
...
dependencies {
    implementation fileTree(dir: "${assetPack}/dist", include: "*.jar")
    implementation fileTree(dir: "${extraPack}/dist", include: "*.jar")
}

Hopefully this helps someone out, it’s been a kind of blessing to me to use gradle for deps but still use jme3 sdk for assets in this way, and is set once and never worry about it again (unless the name of the ant project changes, or you modify any of its build tasks, but I haven’t found a good reason to do so).

From what I’ve heard around the 3.3 SDK, this should not be needed, but I haven’t gotten my hands on the 3.3 SDK yet (potato internet would take 6 hours to download the new SDK, about an hour per 100mb), so I haven’t gotten to test that.

This method works in both development and runtime environments, as the other project is build into jar of the gradle project