17.08.2016 Views

Apache Maven 3 Cookbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 6<br />

How to do it...<br />

Follow the subsequent steps to install and set up the Android SDK:<br />

1. Extract the downloaded Android SDK into any folder.<br />

2. Define the ANDROID_HOME environment variable. The value of ANDROID_HOME<br />

should be the root directory of the Android SDK. The following commands can be<br />

used to define ANDROID_HOME:<br />

### Linux ### export ANDROID_HOME=/opt/android-sdk<br />

### Windows ### set ANDROID_HOME=C:\android-sdk<br />

3. An optional step here is to install the ANDROID_HOME/tools to the PATH<br />

environment variable. (Check the <strong>Maven</strong> Installation section in Chapter 1,<br />

Basics of <strong>Apache</strong> <strong>Maven</strong> for instructions on modifying the PATH variable)<br />

The following steps are now optional as Android SDK artifacts<br />

have been made available in the <strong>Maven</strong> Central Repository.<br />

4. The installation and setting up of the Android SDK is followed by the installation of<br />

the Android API JARS (or Android artifacts) in the <strong>Maven</strong> repository.<br />

5. The <strong>Maven</strong> Android SDK deployer tool allows you to deploy in a local repository as well<br />

as in a remote repository server. The <strong>Maven</strong> Android SDK deployer tool is available at:<br />

http://github.com/mosabua/maven-android-sdk-deployer.<br />

The source needs to be downloaded from the GitHub repository of the <strong>Maven</strong> Android<br />

SDK deployer and needs to replace the Android SDK. The Android API JARS (artifacts)<br />

can now be installed in local and remote repositories. We will be running <strong>Maven</strong> build<br />

phase commands to do the same.<br />

6. Installation into a <strong>Maven</strong> local repository is pretty simple. Open the command<br />

line and navigate to the <strong>Maven</strong> Android SDK deployer root folder and execute the<br />

following command:<br />

$ mvn clean install<br />

7. To install these on a remote repository, make sure the remote repository is defined in<br />

the <strong>Maven</strong> settings.xml file. Additionally, the server credentials need to be added<br />

as well:<br />

<br />

<br />

<br />

android.repo<br />

your username<br />

your password<br />

127

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!