https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
e

Egor Okhterov

03/04/2020, 10:01 AM
Still doesn't work in
1.3.70
Copy code
There was a failure while populating the build operation queue: NPM project resolved without org.jetbrains.kotlin.gradle.targets.js.npm.KotlinNpmResolutionManager@1e3aed99
NPM project resolved without org.jetbrains.kotlin.gradle.targets.js.npm.KotlinNpmResolutionManager@1e3aed99
b

Big Chungus

03/04/2020, 10:03 AM
Did you apply
kotlin.js
or
kotlin.multiplatform
? Because top level npm dependencies are only available when applying
kotlin.js
plugin.
e

Egor Okhterov

03/04/2020, 10:05 AM
When I add plugin, I get error 😃
Copy code
Build file 'H:\Projects\wf-mobile\Server\admin-tool\build.gradle.kts' line: 6

Error resolving plugin [id: 'org.jetbrains.kotlin.js', version: '1.3.70']
> Plugin request for plugin already on the classpath must not include a version
b

Big Chungus

03/04/2020, 10:06 AM
Just remove the version
I imagine this is multi-module project and you've declared kotlin plaugin version somewhere further down the root
e

Egor Okhterov

03/04/2020, 10:07 AM
That's true
Removing version produces same error
b

Big Chungus

03/04/2020, 10:08 AM
Any chance I could have a look at the repo? Hard to pinpoint the issue without context
e

Egor Okhterov

03/04/2020, 10:09 AM
Sorry, that's corporate project under NDA, etc. But I can share root
build.gradle.kts
in a minute...
b

Big Chungus

03/04/2020, 10:09 AM
Understandable. Can you share all files where you mention kotlin version, then?
e

Egor Okhterov

03/04/2020, 10:09 AM
That is the root.
b

Big Chungus

03/04/2020, 10:10 AM
remove line 49
And then apply kotlin subprojects directly
Because this line applies JVM plugin which denies the application of JS plugin in submodule
e

Egor Okhterov

03/04/2020, 10:11 AM
which denies the application of JS plugin
Oh, didn't know that
b

Big Chungus

03/04/2020, 10:12 AM
Or alternatively you can do something like this in the root to exclude js module
Copy code
subprojects.filter{it.name != "<js module name>"}
That way you can still config all modules except js as you did without interfering with it
Looking at how much JVM-specific config you;re doing on root it's probably best to go with the filtering option.
e

Egor Okhterov

03/04/2020, 10:14 AM
And I suppose that I have to use
multiplatform
plugin instead of
js
, because I have to compile server to jvm bytecode and web interface to javaScript
b

Big Chungus

03/04/2020, 10:14 AM
No need.
Just filter our js module from your subprojects config on root
Which will let you do whatever you want on that module freely
e

Egor Okhterov

03/04/2020, 10:16 AM
I think we have bad architecture 😃
Probably web interface should really be a separate module
Right now we have ktor server and javascript files in the same module (
admin-tool
)
b

Big Chungus

03/04/2020, 10:17 AM
Oof
Yes
You need to separate those out into modules
e

Egor Okhterov

03/04/2020, 10:17 AM
Thank you for your help! I appreciate it 😃
b

Big Chungus

03/04/2020, 10:19 AM
Did you manage to resolve the issue?
e

Egor Okhterov

03/04/2020, 10:21 AM
I cannot do it right away because of the mess in admin-tool. I've started with the wrong stuff -
npm()
is the least problem now
😄 1
b

Big Chungus

03/04/2020, 10:22 AM
For immediate fix keep the modules as they are and just filter out js module from the root submodules config
👍 1
r

r4zzz4k

03/04/2020, 12:45 PM
Are you trying to use Java libraries and npm dependencies in the same project? What do you expect from that?
e

Egor Okhterov

03/04/2020, 12:45 PM
no to both questions 😃
r

r4zzz4k

03/04/2020, 12:49 PM
Oh, I see, you are willing to add one js submodule to the project where all submodules are jvm right now?
Yeah, migration to multiplatform plugin would be the best option in long term, and filtering sounds like the way to go right now. Sorry for missing the point 🙂
e

Egor Okhterov

03/04/2020, 12:50 PM
Yes, I need to make a separate kotlin to js module for web client and a separate kotlin to jvm (ktor) server. Right now we have mixed web client and server in a single module and that's what I need to refactor in the future
I wanted to eat this whole problem in small chunks and start with integrating
npm
into gradle scripts. Right now we download javascript libraries manually and push them into our local source control which is a bad practice.
l

louiscad

03/04/2020, 12:55 PM
Your project's classpath is still on 1.3.61 or lower, possibly because of buildSrc or buildscript dependency, possibly transitive.
e

Egor Okhterov

03/04/2020, 12:55 PM
That’s not the case
l

louiscad

03/04/2020, 1:14 PM
Are you using
kotlin("js")
something different?