我试图在 dart 中创建一个“库”类型的项目,然后从另一个项目“依赖”该库(全部使用 yaml 文件的路径依赖功能)。我知道,如果我托管我的库或使用 GIT,我可能能够让依赖项工作,但我也不想这样做,因为我觉得纯基于文件系统的依赖项应该是“不费吹灰之力” .
所以,不用多说,这是我的情况。我有一个非常简单的基于 web_ui 的 dart 库/项目,其中包含两个文件:
esrvdartui.dart
---------------
library esrvdartui;
import 'dart:html';
import 'package:web_ui/web_ui.dart';
part 'esrvradiobutton.dart';
esrvradiobutton.dart
--------------------
part of esrvdartui;
class ESrvRadioButton extends RadioButtonInputElement
{
ESrvRadioButton ()
{
}
}
然后我创建了另一个非常小的/简单的基于 web_ui 的项目,名为“ExampleForm”,它想要使用我上面的 esrvdartui 项目。这两个项目都存在于相同的目录结构中。我的 ExampleForm 项目包含以下 yaml 文件:
pubspec.yaml
------------
name: ExampleForm
description: A sample WebUI application
dependencies:
js: any
browser: any
web_ui: any
esrvdartui:
path: ../esrvdartui
无论我在上面的 yaml 文件中将路径设置为什么,我都不会看到我的 ExampleForm 项目下的 web\packages 目录被我的来自 esrvdartui 项目的文件更新,因此,我无法使用我的库中的文件使用基于文件的依赖方法,因为我的 ExampleForm 项目的构建失败。
“Pub install”不会抱怨上面的路径,当我使用绝对路径时它不会抱怨,所以我知道“Pub install”看到我的依赖项目。它只是不会为我复制该死的文件。
有什么想法吗?
ExampleForm 我的 pubspec.lock 文件是:
# 由 pub 生成 # 见http://pub.dartlang.org/doc/glossary.html#lockfile {"packages":{"logging":{"version":"0.5.0+1","source":"hosted","description":"logging"},"source_maps":{"version":" 0.5.0+1","source":"hosted","description":"source_maps"},"unittest":{"version":"0.5.0+1","source":"hosted","描述":"unittest"},"pathos":{"version":"0.5.0+1","source":"hosted","description":"pathos"},"analyzer_experimental":{"version" :"0.4.7+1","source":"hosted","description":"analyzer_experimental"},"web_ui":{"version":"0.4.6+1","source":"hosted","description":"web_ui"},"js":{"version":"0.0.21","source":"hosted","description":"js"},"csslib":{ "version":"0.4.3","source":"hosted","description":"csslib"},"esrvdartui":{"version":"0.0.0","source":"path", "description":{"relative":false,"path":"C:/Users/Jason/dart/esrvdartui"}},"html5lib":{"version":"0.4.3","source":"托管","description":"html5lib"},"args":{"version":"0.5.0+1","source":"hosted","description":"args"},"browser": {"版本":"0.5.0+1","源":"托管","描述":"浏览器"},"元":{"版本":"0.5.0+1","源":"托管","描述":"元"}}}
我的 esrvdartui 的 pubspec.lock 文件是:
由酒馆生成
见http://pub.dartlang.org/doc/glossary.html#lockfile
{"packages":{"meta":"version":"0.5.0+1","source":"hosted","description":"meta"},"browser":{"version":"0.5 .0+1","source":"hosted","description":"browser"},"args":{"version":"0.5.0+1","source":"hosted","description ":"args"},"html5lib":{"version":"0.4.3","source":"hosted","description":"html5lib"},"analyzer_experimental":{"version":"0.5 .0+1","source":"hosted","description":"analyzer_experimental"},"csslib":{"version":"0.4.3","source":"hosted","描述":"csslib"},"web_ui":{"version":"0.4.6+1","source":"hosted","description":"web_ui"},"pathos":{"version" :"0.5.0+1","source":"hosted","description":"pathos"},"js":{"version":"0.0.22","source":"hosted"," description":"js"},"source_maps":{"version":"0.5.0+1","source":"hosted","description":"source_maps"},"unittest":{"version" :"0.5.0+1","source":"hosted","description":"unittest"},"logging":{"version":"0.5.0+1","source":"hosted" "描述":"日志记录"}}}