# Could not find testCompile() for

**URL:** <https://discuss.kotlinlang.org/t/could-not-find-testcompile-for/10048>\
**Category:** Support\
**Created:** [October 28, 2018, 8:32pm UTC](https://discuss.kotlinlang.org/t/could-not-find-testcompile-for/10048 "2018-10-28T20:32:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anikaiful](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/anikaiful/32/4956_2.png) [@anikaiful](https://discuss.kotlinlang.org/u/anikaiful)\
**Post date:** [October 28, 2018, 8:32pm UTC](https://discuss.kotlinlang.org/t/could-not-find-testcompile-for/10048/1 "2018-10-28T20:32:55Z")

</div>

So, as a n00b I thought to add some testing stuff to a project with

```auto
buildscript {
    ext.kotlin_version = '1.2.71'
    // yaddayadda.... 
}

dependencies {
    compile "org.json:json:20180813"
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
    testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
    // more yadda.... 
}

```

Issuing `./gradlew build` throws the following in my face:

```auto
> Could not find method testCompile() for arguments [org.jetbrains.kotlin:kotlin-test:1.2.71] on object type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

```

I’m baffled…

---

<div class="post-metadata">

**Author:** ![lamba92](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/lamba92/32/5089_2.png) [@lamba92](https://discuss.kotlinlang.org/u/lamba92)\
**Post date:** [October 28, 2018, 9:07pm UTC](https://discuss.kotlinlang.org/t/could-not-find-testcompile-for/10048/2 "2018-10-28T21:07:28Z")

</div>

Post the entire script and in the meantime you may try to run in console from the project root directory `gradlew build` and post the output as well

---

<div class="post-metadata">

**Author:** ![anikaiful](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/anikaiful/32/4956_2.png) [@anikaiful](https://discuss.kotlinlang.org/u/anikaiful)\
**Post date:** [October 28, 2018, 9:15pm UTC](https://discuss.kotlinlang.org/t/could-not-find-testcompile-for/10048/3 "2018-10-28T21:15:05Z")

</div>

Well, here’s the `build.gradle` contents at the moment:

```auto
buildscript {
	ext.kotlin_version = '1.2.71'
	repositories {
		maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" }
		maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
		mavenCentral()
	}
	dependencies {
		classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
		classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:1.3.0-rc-146"
    }
}

apply plugin: 'org.jetbrains.kotlin.platform.native'

repositories {
	maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" }
	maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
	mavenCentral()
}

dependencies {
	compile "org.json:json:20180813"
	compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
//	testCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
//	testCompile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
	testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
}

components.main {
	outputKinds = [EXECUTABLE]
	version = "0.0.0.2"
	dependencies {
		cinterop('libcurl-interop') {
			defFile 'src/main/c_interop/libcurl.def'
			target('linux_x64') {
				includeDirs.headerFilterOnly '/usr/include', '/usr/include/x86_64-linux-gnu'
			}
		}
	}
}

```

And console output from project root:

```auto

FAILURE: Build failed with an exception.

* Where:
Build file '/home/anikaiful/Dropbox/Projects/kotlin/edsms/build.gradle' line: 33

* What went wrong:
A problem occurred evaluating root project 'edsms'.
> Could not find method testCompile() for arguments [org.jetbrains.kotlin:kotlin-test:1.2.71] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

```

---

<div class="post-metadata">

**Author:** ![pdvrieze](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/pdvrieze/32/1882_2.png) [@pdvrieze](https://discuss.kotlinlang.org/u/pdvrieze)\
**Post date:** [October 30, 2018, 12:27pm UTC](https://discuss.kotlinlang.org/t/could-not-find-testcompile-for/10048/4 "2018-10-30T12:27:07Z")

</div>

testCompile and compile are the old gradle method names. You should use testImplementation and implementation. However you are mixing as plugin kotlin 1.2.71 with 1.3.0-rc… Use one version, as mixing will violate all kinds of assumptions.

---

<div class="post-metadata">

**Author:** ![anikaiful](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/anikaiful/32/4956_2.png) [@anikaiful](https://discuss.kotlinlang.org/u/anikaiful)\
**Post date:** [October 30, 2018, 1:53pm UTC](https://discuss.kotlinlang.org/t/could-not-find-testcompile-for/10048/5 "2018-10-30T13:53:20Z")

</div>

Ah, compile → implementation. That sorted that, thanks 😃

But if I try use e.g. `... -native-gradle-plugin:$kotlin_version` I get a sorry error that `Could not find org...plugin:1.2.71`, followed by a litany of searched sites, whereas `1.3.0-rc-146` is found just fine.

---

<div class="post-metadata">

**Author:** ![pdvrieze](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/pdvrieze/32/1882_2.png) [@pdvrieze](https://discuss.kotlinlang.org/u/pdvrieze)\
**Post date:** [October 30, 2018, 2:04pm UTC](https://discuss.kotlinlang.org/t/could-not-find-testcompile-for/10048/6 "2018-10-30T14:04:41Z")

</div>

You probably want to use 1.3.0-rc-190 across (no reason not to use the latest prerelease), or use the old multiplatform plugins for native (especially on native there has been a lot of work in the new ones so if you can stick with pre-release that is probably better).

---

<div class="post-metadata">

**Author:** ![anikaiful](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/anikaiful/32/4956_2.png) [@anikaiful](https://discuss.kotlinlang.org/u/anikaiful)\
**Post date:** [October 30, 2018, 3:07pm UTC](https://discuss.kotlinlang.org/t/could-not-find-testcompile-for/10048/7 "2018-10-30T15:07:45Z")

</div>

Much appreciated suggestion 😁 - did that and no more errors. For some reason I didn’t realise that version upgrade was as simple as changing the ext.kotlin\_version in the script… 🤐 thought it meant version which you already have, and not something that gradle will fetch for you if you don’t have.
