# Can't add dependencies to the project

**URL:** https://discuss.gradle.org/t/cant-add-dependencies-to-the-project/6307
**Category:** Old Forum Archive
**Created:** [June 7, 2014, 7:51pm UTC](https://discuss.gradle.org/t/cant-add-dependencies-to-the-project/6307 "2014-06-07T19:51:00Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![XanderMax](https://avatars.discourse-cdn.com/v4/letter/x/ecccb3/32.png) [@XanderMax](https://discuss.gradle.org/u/XanderMax)
#### Post date: [June 7, 2014, 7:51pm UTC](https://discuss.gradle.org/t/cant-add-dependencies-to-the-project/6307/1 "2014-06-07T19:51:00Z")

</div>

Hello everyone) I’am just newbie to Gradle, and I’ve faced a problem when adding dependencies to my java project. I need to add WEKA and Guava libraries to my project. Both are available in the Maven Central Repository. Here is my gradle script code (the content of build.gradle)

```gradle
apply plugin: 'java'
apply plugin: 'eclipse'
    repositories {
    mavenCentral()
}
  dependencies {
    runtime group: 'com.google.guava', name: 'guava', version: '17.0'
    runtime group: 'nz.ac.waikato.cms.weka', name: 'weka-stable', version: '3.6.6'
}

```

When I’am running

```gradle
gradle build

```

from CMD, I’am getting a lot of error messages, inferring that neither of those libraries were added to project. Surely the build fails. I don’t know what to do. Thanks in advance)

---

<div class="post-metadata">

### Author: ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)
#### Post date: [June 8, 2014, 4:00am UTC](https://discuss.gradle.org/t/cant-add-dependencies-to-the-project/6307/2 "2014-06-08T04:00:00Z")

</div>

You need to make them ‘compile’ dependencies.

---

<div class="post-metadata">

### Author: ![XanderMax](https://avatars.discourse-cdn.com/v4/letter/x/ecccb3/32.png) [@XanderMax](https://discuss.gradle.org/u/XanderMax)
#### Post date: [June 8, 2014, 6:20am UTC](https://discuss.gradle.org/t/cant-add-dependencies-to-the-project/6307/3 "2014-06-08T06:20:00Z")

</div>

Thank You for reply)) But in the gradle book it says that

```gradle
runtime

```

task depends on the

```gradle
compile

```

one. Can You please tell me what is special about

```gradle
runtime

```

, that makes my build script fail.

---

<div class="post-metadata">

### Author: ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)
#### Post date: [June 8, 2014, 6:23am UTC](https://discuss.gradle.org/t/cant-add-dependencies-to-the-project/6307/4 "2014-06-08T06:23:00Z")

</div>

The fact that ‘runtime’ extends from ‘compile’ means that every compile dependency is also a runtime dependency. The inverse isn’t true, hence if you only make these ‘runtime’ dependencies yet reference them from your Java code, compilation will fail.

---

<div class="post-metadata">

### Author: ![XanderMax](https://avatars.discourse-cdn.com/v4/letter/x/ecccb3/32.png) [@XanderMax](https://discuss.gradle.org/u/XanderMax)
#### Post date: [June 8, 2014, 12:59pm UTC](https://discuss.gradle.org/t/cant-add-dependencies-to-the-project/6307/5 "2014-06-08T12:59:00Z")

</div>

Thank you very much))
