如何设置完全脱机的Cordova构建? [英] How to set up fully offline Cordova build?

查看:178
本文介绍了如何设置完全脱机的Cordova构建?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用cordova create hello com.example.hello HelloWorld ; cd hello ; cordova platform add android在Cordova中创建了一个测试项目.

I have created a test project in Cordova using cordova create hello com.example.hello HelloWorld ; cd hello ; cordova platform add android.

我第一次使用cordova build构建它时,它会下载Gradle,然后我认为是一堆Maven文件,其中将近200个.这些似乎已安装到~/.gradle中,但我不确定这是唯一的地方.样本输出:

The first time I build it with cordova build, it downloads Gradle, and then what I think is a bunch of Maven files, almost 200 of them. These seem to be installed into ~/.gradle but I'm not sure that is the only place. Sample output:

$ 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)

现在,这可能很方便,但从具有可复制的构建环境的角度来看绝对不是理想的选择.

Now, this may be convenient, but absolutely not desirable from the perspective of having a reproducible build environment.

如何设置Cordova以进行完全脱机构建?它会在第一个版本之后进行离线构建,还是仍在检查(例如)Gradle更新?

How do I set up Cordova to do fully offline builds? Would it do offline builds after the first one, or does it still check for (eg) Gradle updates?

如何(在哪里)预安装cordova build查找的所有内容?有没有办法让Cordova在进行构建时将其作为单独的步骤来安装所有内容,而在进行此安装时将其作为单独的步骤来进行构建?

How (and where) do I pre-install everything that cordova build looks for? Is there a way to get Cordova to install everything as a separate step from doing a build, and to do a build as a separate step from doing this install?

我可以一次存档~/.gradle/的内容,然后在进行构建之前(在同一台计算机上或在另一台计算机上)解压缩它并使该构建脱机运行吗?如何将~/.gradle/移至(例如)Cordova项目的子目录?

Can I archive the contents of ~/.gradle/ once, and then unpack it before doing a build (either on the same machine or a different one) and have that build run offline? How do I move ~/.gradle/ to (for example) a subdirectory of the Cordova project?

这是在Ubuntu 16.04的全新安装中,其中node和npm是从nodesource安装的.版本:

This is on a clean install of Ubuntu 16.04, with node and npm installed from nodesource. Versions:

$ cordova --version
7.0.1
$ npm --version
3.10.10
$ node --version
v6.10.3

推荐答案

听起来有些棘手.我想到的一种可能性是:您可以使用已在计算机上安装了android和cordova的 docker 映像没有互联网.您会发现许多像这样的开源图像:例如,在搜索时 docker-cordova . "cordova码头工人形象".

Sounds tricky. One possibility that comes to my mind: you could use a docker image with android and cordova already installed on your machine without internet. You will find many open-source images like this one: docker-cordova when searching for e.g. "cordova docker image".

这篇关于如何设置完全脱机的Cordova构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆