我有一台机器没有 互联网连接。
我在Cordova中使用cordova创建了一个测试项目hello com.example.hello HelloWorld; cd你好; cordova平台添加android。
我第一次使用cordova构建它(在带有互联网的机器上),它下载了Gradle,然后我认为是一堆Maven文件,其中近200个。这些似乎安装在〜/ .gradle中,但我不确定这是唯一的地方。样本输出:
$ cordova build
ANDROID_HOME=/opt/android
JAVA_HOME=/usr/lib/jvm/java-8-oracle/
Subproject Path: CordovaLib
Downloading https://services.gradle.org/distributions/gradle-3.3-all.zip
...............
Unzipping /home/ubuntu/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3-all.zip to /home/ubuntu/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9
Set executable permissions for: /home/ubuntu/.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3/bin/gradle
Starting a Gradle Daemon (subsequent builds will be faster)
Download https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
Download https://jcenter.bintray.com/com/android/tools/build/gradle-core/2.2.3/gradle-core-2.2.3.pom
Download https://jcenter.bintray.com/com/android/tools/build/builder/2.2.3/builder-2.2.3.pom
Download https://jcenter.bintray.com/com/android/tools/lint/lint/25.2.3/lint-25.2.3.pom
(skip about 180 more lines here)
Download https://repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar
Download https://repo1.maven.org/maven2/nekohtml/xercesMinimal/1.9.6.2/xercesMinimal-1.9.6.2.jar
Download https://repo1.maven.org/maven2/nekohtml/nekohtml/1.9.6.2/nekohtml-1.9.6.2.jar
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
:preBuild UP-TO-DATE
(build continues normally here)
现在,这可能很方便,但从具有可重现的构建环境的角度来看,绝对不可取。
如何设置Cordova以完全脱机构建?它会在第一个之后执行离线构建,还是仍然检查(例如)Gradle更新?
我如何(以及在何处)预先安装cordova构建所需的所有内容?有没有办法让Cordova安装所有东西作为一个单独的步骤,从做一个构建,并作为一个单独的步骤进行此安装?
我可以归档〜/ .gradle / once的内容,然后在进行构建之前(在同一台机器上或另一台机器上)解压缩并使该构建版本脱机吗?如何将〜/ .gradle /移动到(例如)Cordova项目的子目录?
我已将〜/ .gradle /文件夹复制到Ubuntu机器。
我错过了什么吗?
这是一个干净安装的Ubuntu 16.04,从nodesource安装了node和npm。版本:
$ cordova --version
7.0.1
$ npm --version
3.10.10
$ node --version
v6.10.3