# KotlinJS library sources?

**URL:** <https://discuss.kotlinlang.org/t/kotlinjs-library-sources/9425>\
**Category:** JavaScript\
**Created:** [September 13, 2018, 3:33pm UTC](https://discuss.kotlinlang.org/t/kotlinjs-library-sources/9425 "2018-09-13T15:33:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nanodeath](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/nanodeath/32/1803_2.png) [@nanodeath](https://discuss.kotlinlang.org/u/nanodeath)\
**Post date:** [September 13, 2018, 3:33pm UTC](https://discuss.kotlinlang.org/t/kotlinjs-library-sources/9425/1 "2018-09-13T15:33:20Z")

</div>

If I have two KotlinJS projects, and one is a library that’s publishing a JAR containing JS to MavenLocal, and the other is an application consuming that library…how do I make it so I can “attach sources” in the application?

The library’s JAR looks like this:

- library.js
- library.js.map
- library.meta.js
- library/root-package.kjsm

The application can compile just fine against the library, but if I try to Go To Source on the library methods I get the decompiler stub.

---

<div class="post-metadata">

**Author:** ![nanodeath](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/nanodeath/32/1803_2.png) [@nanodeath](https://discuss.kotlinlang.org/u/nanodeath)\
**Post date:** [September 15, 2018, 4:30am UTC](https://discuss.kotlinlang.org/t/kotlinjs-library-sources/9425/2 "2018-09-15T04:30:24Z")

</div>

To answer my own question…you just publish your Kotlin sources as usual, as documented [here](https://docs.gradle.org/current/userguide/publishing_maven.html#publishing_maven:complete_example), in a `*-sources.jar`. I had to use `sourceSets.main.allSource` instead of `sourceSets.main.allJava`, though, for the sources JAR.
