I don’t know much about gradle. This is my first project using gradle. I usually use maven and I use ant when learning jme.
The main class cannot be found .
Searching the forums I found an almost identical question.
The only difference is that I was able to run it properly in the sdk.
However, the constructed jar package cannot be run.
can see it’s working fine in the sdk.
But the run of the built jar package shows that the main class cannot be found
I checked the MANIFEST.MF file in jar and there was Main-class. I could not figure out the problem for a while. If anyone can find out the problem, please let me know, thank you very much
plugins {
id 'java'
id 'application'
id "de.undercouch.download" version "5.1.0"
id "io.github.0ffz.github-packages" version "1.2.1" // Plugin for anonymous inclusion of artifacts hosted in github package registry
}
group 'mygame'
version '1.0'
mainClassName = "mygame.main"
repositories {
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
project.ext {
jmeVer = '3.6.0-stable'
}
project(":assets") {
apply plugin: "java"
buildDir = rootProject.file("build/assets")
sourceSets {
main {
resources {
srcDir '.'
}
}
}
}
dependencies {
// Core JME
implementation "org.jmonkeyengine:jme3-core:$jmeVer"
implementation "org.jmonkeyengine:jme3-desktop:$jmeVer"
implementation "org.jmonkeyengine:jme3-lwjgl3:$jmeVer"
// Suppress errors / warnings building in SDK
implementation "org.jmonkeyengine:jme3-jogg:$jmeVer"
implementation "org.jmonkeyengine:jme3-plugins:$jmeVer"
// GUI Library
implementation 'com.simsilica:lemur:1.16.0'
implementation 'com.simsilica:lemur-proto:1.13.0'
// Physics Library
implementation 'com.github.stephengold:Minie:7.5.0'
// Additional Libraries
// Assets sub-project
runtimeOnly project(':assets')
}
jar {
manifest {
attributes 'Main-Class': "$mainClassName"
}
}