Reputation: 1258
I trying include to project Cling, but before I never used manually install from maven.
On page instructions is:
Install Maven 3.2.3 or newer.
Install the Android SDK and set the ANDROID_HOME environment variable to the SDK install directory.
Clone the Cling source:
git clone https://github.com/4thline/cling.git
Change into the cling/ directory.
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.
I have done 1,2,3,4 steps, but what is "Install everything" in step 5, how to do it ?
And last step with pom.xml
, where need to put it?
Upvotes: 1
Views: 1505
Reputation: 137259
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:
git clone https://github.com/4thline/cling.git
at step 3.cling
subdirectory.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.
<dependencies>
<dependency>
<groupId>org.fourthline.cling</groupId>
<artifactId>cling-core</artifactId>
<version>2.1.1-SNAPSHOT</version>
</dependency>
</dependencies>
I strongly suggest that you read the Maven book from Sonatype to get you acquainted with using Maven.
Upvotes: 1