Creating cordova 5.x android gradle build offline

Recently I upgraded my Cordova project from Cordova 3.0 to 5.3.3 and Android platform from 3.6 to 4.1. New android platform uses gradle for build and need to connect to internet (maven repo) every day for building. Once it connects to repo, it does not require connection for that day.

I am working behind the proxy which does not have access to maven repo. I am new to gradle build and want to configure gradle for offline building cordova application.

Here are environment details

  • OS -> MAC OSX
  • Cordova version -> 5.3.3
  • Cordova Android platform version -> 4.1

Kindly suggest.

Answers


Dependencies are declared in Gradle in the dependencies section and the repositories section controls where the dependencies are fetched from. For example:

repositories {
     jcenter()
}

dependencies {
    compile 'com.google.guava:guava:18.0'
}

This says, guava:18.0 is fetched during compile time, from the jcenter() repository. You can also use maven central as:

repositories {
    mavenCentral()
}

A custom repo like a company repo as:

repositories {
    maven {
        url "http://repo.mycompany.com/maven2"
    }
}

or, the local .m2 repo as:

repositories {
    mavenLocal()
}

You can define multiple repositories as well:

repositories {
    mavenLocal()
    jcenter()
}

Gradle searches for dependencies in the order that the repositories are listed. So it will look in local .m2 first, and if a matching dependency isn't available, it goes out to JCenter to download dependencies.


Need Your Help

What is wrong with this MySQL Trigger that prevents null dates?

mysql sql triggers

I am trying to create this trigger to prevent insertion of null dates:

Calling JavaScript functions from HTML

javascript

How do I execute a JS object's function property from an HTML link?