Could not find method compile() for arguments [com.simsilica:zay-es:1.2.1]

i try insert zay-es in project

plugins {
    id 'application'
    id 'java'
    id "de.undercouch.download" version "5.1.0"
    id 'idea'
    id "io.github.0ffz.github-packages" version "1.2.1" // Plugin for anonymous inclusion of artifacts hosted in github package registry
}

description = 'DungeonRPG application'

java {
    sourceCompatibility = '11'
    targetCompatibility = '11'
}

ext.jmonkeyengineVersion = '3.5.2-stable'

mainClassName = 'dungeonrpg.DungeonRPG'
if (!hasProperty('mainClass')) {
    ext.mainClass = mainClassName
}
jar.manifest.attributes('Main-Class': mainClassName)

repositories {
    mavenCentral()
    mavenLocal()
}

dependencies {
    // You can read more about how to add dependencies here:
    //   https://docs.gradle.org/current/userguide/dependency_management.html#sec:how_to_declare_your_dependencies

    implementation 'org.jmonkeyengine:jme3-core:' + jmonkeyengineVersion
    implementation 'org.jmonkeyengine:jme3-desktop:' + jmonkeyengineVersion
    runtimeOnly 'org.jmonkeyengine:jme3-jogg:' + jmonkeyengineVersion
    runtimeOnly 'org.jmonkeyengine:jme3-plugins:' + jmonkeyengineVersion

    implementation 'org.jmonkeyengine:jme3-effects:' + jmonkeyengineVersion
    implementation 'org.jmonkeyengine:jme3-jbullet:' + jmonkeyengineVersion
    runtimeOnly 'org.jmonkeyengine:jme3-lwjgl3:' + jmonkeyengineVersion

    implementation 'com.simsilica:lemur:1.16.0'
    implementation 'com.simsilica:lemur-proto:1.13.0'
    
    compile "com.simsilica:zay-es:1.2.1"
    compile "com.simsilica:zay-es-net:1.2.1"
    implementation("com.google.guava:guava:31.1-jre")
    implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.6'

}

distZip {
    //having a degenerate folder within the dist zip complicates generating the other zips
    eachFile { file ->
        String path = file.relativePath
        file.setPath(path.substring(path.indexOf("/") + 1, path.length()))
    }
    includeEmptyDirs(false)
}

//See https://api.adoptium.net/v3/assets/feature_releases/11/ga?image_type=jre for jre urls
def windowsJreUrl = "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jre_x64_windows_hotspot_11.0.15_10.zip"
def linuxJreUrl = "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jre_x64_linux_hotspot_11.0.15_10.tar.gz"
def macJreUrl = "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jre_x64_mac_hotspot_11.0.15_10.tar.gz"


task downloadWindowsJre(type: Download) {
    src windowsJreUrl
    dest new File(buildDir, '/jres/windowsJre.zip')
    overwrite false
}

task downloadAndUnzipWindowsJre(dependsOn: downloadWindowsJre, type: Copy) {
    from zipTree(downloadWindowsJre.dest)
    into "${buildDir}/jres/windowsJre/"
    includeEmptyDirs(false)
    filesMatching("**") {
        it.path = it.path.replaceAll("^[a-zA-Z0-9.+-]*[/\\\\]", "jre/") //rename the top level to something standard so the rest of the script will be easier
    }
}

task buildWindowsDistribution(dependsOn: [distZip, downloadAndUnzipWindowsJre], type: Copy)
{
    group 'distribution'
    from files("${projectDir}/scripts/desktopDeployment/DungeonRPG.bat"), zipTree(distZip.archiveFile), "${buildDir}/jres/windowsJre"
    into new File(buildDir, 'distributions/DungeonRPG-windows')
    includeEmptyDirs false
    exclude 'bin/**' //we are adding our own run scripts, exclude the ones coming from distZip
}

task zipWindowsDistribution( dependsOn:buildWindowsDistribution, type: Zip) {
    group 'distribution'
    archiveFileName = "DungeonRPG-windows.zip"
    destinationDirectory = file("$buildDir/distributions")
    from "$buildDir/distributions/DungeonRPG-windows"
}


task downloadLinuxJre(type: Download) {
    src linuxJreUrl
    dest new File(buildDir, '/jres/linuxJre.tar.gz')
    overwrite false
}

task downloadAndUnzipLinuxJre(dependsOn: downloadLinuxJre, type: Copy) {
    from tarTree(downloadLinuxJre.dest)
    into "${buildDir}/jres/linuxJre/"
    includeEmptyDirs(false)
    filesMatching("**") {
        it.path = it.path.replaceAll("^[a-zA-Z0-9.+-]*[/\\\\]", "jre/") //rename the top level to something standard so the rest of the script will be easier
    }
}

task buildLinuxDistribution(dependsOn: [distZip, downloadAndUnzipLinuxJre], type: Copy)
{
    group 'distribution'
    from files("${projectDir}/scripts/desktopDeployment/DungeonRPG.sh"){
        fileMode 0755
    }
    from zipTree(distZip.archiveFile)
    from "${buildDir}/jres/linuxJre"
    into new File(buildDir, 'distributions/DungeonRPG-linux')
    includeEmptyDirs false
    exclude 'bin/**' //we are adding our own run scripts, exclude the ones coming from distZip
}

task zipLinuxDistribution( dependsOn:buildLinuxDistribution, type: Zip) {
    group 'distribution'
    archiveFileName = "DungeonRPG-linux.tar.gz"
    destinationDirectory = file("$buildDir/distributions")
    from ("$buildDir/distributions/DungeonRPG-linux"){
      include('**.sh')
      include('**/java')
      fileMode 0755
    }
    from ("$buildDir/distributions/DungeonRPG-linux"){
        exclude('**.sh')
        exclude('**/java')
    }
}


task downloadMacJre(type: Download) {
    src macJreUrl
    dest new File(buildDir, '/jres/macJre.tar.gz')
    overwrite false
}

task downloadAndUnzipMacJre(dependsOn: downloadMacJre, type: Copy) {
    from tarTree(downloadMacJre.dest)
    into "${buildDir}/jres/macJre/"
    includeEmptyDirs(false)
    filesMatching("**") {
        it.path = it.path.replaceAll("^[a-zA-Z0-9.+-]*[/\\\\]", "jre/") //rename the top level to something standard so the rest of the script will be easier
    }
}

task buildMacDistribution(dependsOn: [distZip, downloadAndUnzipMacJre], type: Copy)
{
    group 'distribution'
    from files("${projectDir}/scripts/desktopDeployment/DungeonRPG.command"){
        fileMode 0755
    }
    from zipTree(distZip.archiveFile) 
    from "${buildDir}/jres/macJre"
    into new File(buildDir, 'distributions/DungeonRPG-mac')
    includeEmptyDirs false
    exclude 'bin/**' //we are adding our own run scripts, exclude the ones coming from distZip
}

task zipMacDistribution( dependsOn:buildMacDistribution, type: Zip) {
    group 'distribution'
    archiveFileName = "DungeonRPG-mac.tar.gz"
    destinationDirectory = file("$buildDir/distributions")
    from ("$buildDir/distributions/DungeonRPG-mac"){
      include('**.command')
      include('**/java')
      fileMode 0755
    }
    from ("$buildDir/distributions/DungeonRPG-mac"){
        exclude('**.command')
        exclude('**/java')
    }
}

task buildAllDistributions{
    group 'distribution'
    dependsOn 'zipWindowsDistribution'
    dependsOn 'zipLinuxDistribution'
    dependsOn 'zipMacDistribution'
}

// cleanup tasks
clean.dependsOn('cleanDLLs', 'cleanDyLibs', 'cleanLogs', 'cleanSOs')
task cleanDLLs(type: Delete) {
    delete fileTree(dir: '.', include: '*.dll')
}
task cleanDyLibs(type: Delete) {
    delete fileTree(dir: '.', include: '*.dylib')
}
task cleanLogs(type: Delete) {
    delete fileTree(dir: '.', include: 'hs_err_pid*.log')
}
task cleanSOs(type: Delete) {
    delete fileTree(dir: '.', include: '*.so')
}

task fund(){
    doLast {
       java.awt.Desktop.desktop.browse "https://start.jmonkeyengine.org/#!funding=JME_DESKTOP,JME_EFFECTS,LEMUR,JME_JBULLET".toURI()
    }
}
A problem occurred evaluating root project 'DungeonRPG'.
> Could not find method compile() for arguments [com.simsilica:zay-es:1.2.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

i load jar dependency from folder

    implementation files('libs/zay-es-1.5.0.jar')
    implementation files('libs/zay-es-net-1.5.2.jar')

All you had to do was switch that from ā€˜compileā€™ to ā€˜implementationā€™ like all of the other lines.

Itā€™s worth learning at least a little bit about the tools you are using at some point.

but it says so in the documentation

The documentation is from an older version of gradle.

More recent versions of gradle do not support the ā€œcompileā€ configuration and have split it into ā€œapiā€ and ā€œimplementationā€.

Do not be afraid to use google for non-JME-specific questions. I suspect if youā€™d searched for something like ā€œcompile doesnā€™t work in gradleā€ youā€™d have a million hits.

1 Like

thanks i am noob to java development and gradle

i was looking for an error but advised to connect java plugin

Your build already has a java plugin.

image

@nnpa Just choosen this topic one of 99 topics to write this.
Pleaseā€¦ stop doing that. First investigate a littleā€¦ just a little yourself.

even if every of this things are related to JME,
Java is not JME
Gradle is not JME
GLTF is not JME
ECS is not JME
Blender is not JME
Sketchfab is not JME

I have nothing against searching help here about not-JME things, but asking about things that you can spend 1 to 15 minutes to find answer yourself, or creating topics or posts to later remove them, just because you found answer, is not nice.
Remember that many people spent time to reply something that you can find answer easly.
I also were ā€œnoob to java development and gradleā€ but problems like that could solve myself without issue just by googling.

So please, spend just some minutes investigating problem yourself, before posting and then removing or waiting for simple answers.

Its my advise to allow you to be more professional developer.

6 Likes