Waki Waki - 2 years ago 186
Android Question

Cling how to install from github?

I trying include to project Cling, but before I never used manually install from maven.

On page instructions is:

  1. Install Maven 3.2.3 or newer.

  2. Install the Android SDK and set the ANDROID_HOME environment variable
    to the SDK install directory.

  3. Clone the Cling source:

    git clone https://github.com/4thline/cling.git

  4. Change into the cling/ directory.

  5. Install everything into your local ~/.m2 Maven repository (this will
    take a few minutes if all dependencies have to be downloaded for the
    first time).

    mvn clean install

If your build fails with Android/dex packaging errors, you forgot the clean.

  1. Use Cling in your pom.xml with:

    don't know why, but pom.xml not insert here

    you can see pom.xml on github page

I have done 1,2,3,4 steps, but what is "Install everything" in step 5, how to do it ?

And last step with
, where need to put it?

Answer Source

Step 5 comes down to running the command mvn clean install from the command line.

Maven is configured with the help of a file, called the POM file. It is an XML file named pom.xml. This file contains everything that Maven will do during the build. One of those things is to compile the Java sources into a final artifact. To compile the source code, it needs to resolve its dependencies; that is, other libraries that Cling depends on. All of those required libraries are declared in this POM file.

Maven will automatically download every dependency of the project. It will store them (or install them in the Maven jargon) into a local repository. This repository is just a directory structure on your local drive that will contain every JAR and POM that Maven will have downloaded from the Internet (more precisely from remote repositories configured for the project).

Maven will only do that process once. When all the dependencies are installed in your local repository, it won't download them again (by default). That is why the very first build will be longer that the subsequent builds.

So, to go through step 5, you need to:

  • Open a command prompt
  • Go into the directory where you checked out Cling with the command git clone https://github.com/4thline/cling.git at step 3.
  • Go into the cling subdirectory.
  • There should be a pom.xml file here. This is the main entry point for Maven. Run the command mvn clean install from this location.

Step 6 targets the project you are building. When steps 1 to 5 are done, you have compiled and installed the latest version of Cling. Now is the time to use it then!

Well to use it, you need to create a Maven project (there are facilities for that with every major IDE like Eclipse or IntelliJ) and declare that your project will have a dependency on Cling. That declaration is done with this bit of XML in the POM file of your project.


I strongly suggest that you read the Maven book from Sonatype to get you acquainted with using Maven.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download