# When a gradleApi dependency doesn't respond as expected when contentEquals is called with parameter gradleApi that is a new instance

**URL:** <https://discuss.gradle.org/t/when-a-gradleapi-dependency-doesnt-respond-as-expected-when-contentequals-is-called-with-parameter-gradleapi-that-is-a-new-instance/8591>\
**Category:** Bugs\
**Tags:** issue-resolved, gradle-3271\
**Created:** [April 4, 2015, 5:14pm UTC](https://discuss.gradle.org/t/when-a-gradleapi-dependency-doesnt-respond-as-expected-when-contentequals-is-called-with-parameter-gradleapi-that-is-a-new-instance/8591 "2015-04-04T17:14:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ethankhall](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ethankhall/32/2564_2.png) [@ethankhall](https://discuss.gradle.org/u/ethankhall)\
**Post date:** [April 4, 2015, 5:14pm UTC](https://discuss.gradle.org/t/when-a-gradleapi-dependency-doesnt-respond-as-expected-when-contentequals-is-called-with-parameter-gradleapi-that-is-a-new-instance/8591/1 "2015-04-04T17:14:39Z")

</div>

I am trying to write a plugin that will do things specific when someone adds the `gradleApi()` as a dependency. I tried to use the contentEquals method but it will always return false when the objects being compared are different instanced of `dependencies.gradleApi()`

Script:

```
apply plugin: 'java'
println dependencies.gradleApi().contentEquals(dependencies.gradleApi())

```

Result:

```
❯ gradle build
false
:compileJava UP-TO-DATE

```

I have made a patch that would allow users to be able to determine what kind of dependency was added, when its a classpath type (gradleApi, lovalGroovy).

[https://github.com/ethankhall/gradle/tree/make-gradle-api-dependency-work-as-expected](https://github.com/ethankhall/gradle/tree/make-gradle-api-dependency-work-as-expected)

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [April 6, 2015, 12:44am UTC](https://discuss.gradle.org/t/when-a-gradleapi-dependency-doesnt-respond-as-expected-when-contentequals-is-called-with-parameter-gradleapi-that-is-a-new-instance/8591/2 "2015-04-06T00:44:58Z")

</div>

I’ve fixed this for 2.4.

> <https://github.com/gradle/gradle/commit/b885ec4fe9c42e5a2b4d54dc922be2bec6cf8aed>

Thanks for the report.
