Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to include Kotlin Jar dependencies #18

Closed
jmmk opened this issue Feb 13, 2018 · 4 comments
Closed

Unable to include Kotlin Jar dependencies #18

jmmk opened this issue Feb 13, 2018 · 4 comments

Comments

@jmmk
Copy link

jmmk commented Feb 13, 2018

Same issue that I had with the original rules_kotlin: pubref/rules_kotlin#40
Fix for that issue: pubref/rules_kotlin#41

Here's a gist that should reproduce: https://gist.github.com/jmmk/0d73714ffec4efefbe0d0b1858a783df

Am I doing something wrong or does something need to be changed to properly support this?

@jmmk jmmk changed the title Unable to include Kotlin dependencies Unable to include Kotlin Jar dependencies Feb 13, 2018
@hsyed
Copy link
Contributor

hsyed commented Feb 13, 2018

@jmmk what error do you get ?

I see that you are using maven_repositories directly. java_import produces an ijar and is stripping off Kotlin inlining data. Maven repositories uses java_import under the covers.

There is an issue open for this in bazel core to alter the ijar tool, once this is done java_import can be used without problems. Till then if you need to import kotlin jars use kt_jvm_import.

Also notice that your maven_repositories rule is pulling in kotlin dependencies (of a different version). You will have to omit these in maven_repositories, the stdlib, stdlib-jdk7 and stdlib-jdk8 are added implicitly by the rules. If the Jackson kotlin dep does not include inlined functions things might start working, otherwise you have to use kt_jvm_import for the time being.

@jmmk
Copy link
Author

jmmk commented Feb 13, 2018

The error is:

ERROR: /Users/jmmk/Desktop/bazel-kotlin/BUILD:2:1: Compiling 1 Kotlin source files to main.jar failed (Exit 1)
App.kt:1:44: error: unresolved reference: jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
                                           ^
App.kt:4:16: error: unresolved reference: jacksonObjectMapper
  val mapper = jacksonObjectMapper()

See the issues/PR linked above as well as bazelbuild/bazel#4297 for more technical details. Maybe related to your issue?

I'll try out kt_jvm_import, thanks!

@hsyed
Copy link
Contributor

hsyed commented Feb 13, 2018

this file which includes jacksonObjectMapper is full of inline functions

@hsyed
Copy link
Contributor

hsyed commented Feb 13, 2018

Closing this please reopen if there are other issues.

@hsyed hsyed closed this as completed Feb 13, 2018
jongerrish added a commit to jongerrish/rules_kotlin that referenced this issue Apr 16, 2020
Adds exports to kt_jvm_import to enable bazel-deps support.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants