# External Annotations

**URL:** <https://discuss.kotlinlang.org/t/external-annotations/409>\
**Category:** Uncategorized\
**Created:** [November 17, 2014, 2:52pm UTC](https://discuss.kotlinlang.org/t/external-annotations/409 "2014-11-17T14:52:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abugov](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@abugov](https://discuss.kotlinlang.org/u/abugov)\
**Post date:** [November 17, 2014, 2:52pm UTC](https://discuss.kotlinlang.org/t/external-annotations/409/1 "2014-11-17T14:52:24Z")

</div>

We annotated a method of an external library as @NotNull using external annotation, so we won't need to use "!!" on the returned value. When compiling with intelliJ this works fine, however when running gradle build we get:

warning:Annotations path entry points to a non-existent location:  
Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type …?  
Execution failed for task ‘:compileKotlin’.

it looks like grade isn’t aware of the external annotations file?

10x,  
Alex

---

<div class="post-metadata">

**Author:** ![Natalia.Ukhorskaya](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/natalia.ukhorskaya/32/1447_2.png) [@Natalia.Ukhorskaya](https://discuss.kotlinlang.org/u/Natalia.Ukhorskaya)\
**Post date:** [November 17, 2014, 3:00pm UTC](https://discuss.kotlinlang.org/t/external-annotations/409/2 "2014-11-17T15:00:48Z")

</div>

Hi, If you want to add annotations for some of your libraries, you should add the following line to your build.gradle file:

> kotlinOptions.annotations = file('\<path to annotations\>')

Annotations for JDK should be configured automatically. Here is a [link](http://kotlinlang.org/docs/reference/using-gradle.html#using-external-annotations)

---

<div class="post-metadata">

**Author:** ![abugov](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@abugov](https://discuss.kotlinlang.org/u/abugov)\
**Post date:** [November 17, 2014, 3:59pm UTC](https://discuss.kotlinlang.org/t/external-annotations/409/3 "2014-11-17T15:59:00Z")

</div>

works! 10x for the quick reply!

---

<div class="post-metadata">

**Author:** ![tango24](https://avatars.discourse-cdn.com/v4/letter/t/74df32/32.png) [@tango24](https://discuss.kotlinlang.org/u/tango24)\
**Post date:** [December 27, 2020, 12:49pm UTC](https://discuss.kotlinlang.org/t/external-annotations/409/4 "2020-12-27T12:49:28Z")

</div>

> [@Natalia.Ukhorskaya](#):
>
> kotlinOptions.annotations = file(‘’)

Is this still valid? I cannot find it. Has it been moved?
