sab
sab

Reputation: 5032

import a lib maven into npm package.json

I use gradle to build a kotlin multiplatform lib (i use -surprise- the org.jetbrains.kotlin.multiplatform !!) I build it to mobile, java and js

My issue is that this plugin publish only into maven repository(even the js output lib !), and I want to also use my lib into a node js/npm project.

Is there a way to tell my package.json to search into a maven repo?

Upvotes: 3

Views: 1395

Answers (1)

Nino Filiu
Nino Filiu

Reputation: 18541

Dependencies can be precised in a number of ways in package.json. The most simple and widely used way is the following:

{
  "dependencies": {
    "<package-name>": "<version-range>",
    "lodash": "^4.17.11"
  }
}

But there are actually many ways to include dependencies beyond that. Replace the version range by either one of the following:

  • Tarball URL of the package
  • Git URL of the package, example: git+ssh://[email protected]:npm/cli.git#v1.0.27
  • Github of the package, example: expressjs/express
  • Local paths, example: file:../foo/bar

I'm pretty sure one of these four options can be tweaked to include a dependency from a maven repo.

Upvotes: 1

Related Questions