Could not find method implementation() for arguments [project ':core'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler

As the title says, it is erroring while i try to run the build.gradle file at line 7

dependencies {
    classpath 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0'
    implementation project(":core")
}

I have tried everything I can find in the docs and nothing is coming up on google because this issue appears to only be seen in android building … I’m trying to build a java mod for minecraft

Judging by the classpath line, you are trying to do this within the buildscript block, but you need to do it on the project, so in a dependencies block on top-level.

Actually you usually should not have a buildscript block at all in most cases, but instead use the plugins block to apply plugins.

And imho you should not build a fat jar, but use the application plugin instead to build a proper distribution: https://fatjar.net :slight_smile:

> Could not find method implementation() for arguments [project ':core'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.


        configure(subprojects.findAll { it.name != "core" }) {
	version = mc_version + "-" + mod_version

	dependencies {
		implementation project(":core")
	}

	shadowJar {
		classifier = ""

		relocate "com.mashape.unirest", "net.vampymarie.testing.repack.com.mashape.unirest"
		relocate "com.neovisionaries.ws.client", "net.vampymarie.testing.repack.com.neovisionaries.ws.client"
		relocate "com.sun.jna", "net.vampymarie.testing.repack.com.sun.jna"
		relocate "javax.sound", "net.vampymarie.testing.repack.javax.sound"
		relocate "javazoom", "net.vampymarie.testing.repack.javazoom"
		relocate "net.dv8tion.jda", "net.vampymarie.testing.repack.net.dv8tion.jda"
		relocate "net.sourceforge.jaad", "net.vampymarie.testing.repack.net.sourceforge.jaad"
		relocate "org.apache.commons.codec", "net.vampymarie.testing.repack.org.apache.commons.codec"
		relocate "org.apache.commons.lang3", "net.vampymarie.testing.repack.org.apache.commons.lang3"
		relocate "org.json", "net.vampymarie.testing.repack.org.json"
		relocate "org.kc7bfi.jflac", "net.vampymarie.testing.repack.orgkc7bfi.jflac"
		relocate "org.tritonus", "net.vampymarie.testing.repack.org.tritonus"
		relocate "tomp2p.opuswrapper", "net.vampymarie.testing.repack.tomp2p.opuswrapper"
		
		relocate "org.apache.http", "net.vampymarie.testing.repack.org.apache.http"
		relocate "org.apache.commons.logging", "net.vampymarie.testing.repack.org.apache.commons.logging"

		dependencies {
			include(dependency(":core"))
		}
		
		plugins {
    		id 'com.github.johnrengelman.shadow' version '1.7.0'
		}
	}
}

You probably didn’t apply any plugin that adds the implementation configuration, like java, or java-library, or application, or groovy, or …

Btw. you should not using allprojects or subprojects, that’s discouraged legacy practice. Much better would be if you put your common configuration into convention plugins and apply those in the projects where you need them directly. :slight_smile:

1 Like