11

With java/gradle I may depend on mavenCentral and mavenLocal and publish my own libs to mavenLocal.

How is this done with Dart?

I.e. I have multiple projects that depends on some private libs.

As I can see "pub publish" can only publish to the central repo.

Seth Ladd
  • 112,095
  • 66
  • 196
  • 279
Gunnar Eketrapp
  • 2,009
  • 1
  • 19
  • 33

2 Answers2

14

If you just want to use a package locally, there's no need to "publish" it all. (And I'm not sure what that would even mean.) Instead, you can just use a path dependency to depend on it.

If you have some local package foo and you want to use it from another local package bar, in bar's pubspec, just add:

dependencies:
  foo:
    path: path/to/bar
munificent
  • 11,946
  • 2
  • 38
  • 55
9

What Bob said.

Also, if you need to have multiple developers inside your company all sharing the same internal package, you can use pub's support for git dependencies.

If you push your internal package to a local/internal git server, all your developers can access it.

Here is an example:

dependencies:
  foo:
    git: git://your.internal.server/package.git
Seth Ladd
  • 112,095
  • 66
  • 196
  • 279
  • Ok thanks for the answers! How is with versioning when depending on local file path and git – Gunnar Eketrapp Apr 18 '13 at 05:32
  • You can specify a specific commit, branch, or tag with the "ref" keyword https://www.dartlang.org/tools/pub/dependencies.html#git-packages – jriggins Jul 14 '14 at 17:13