Quickstart with Maven


Quickstart with Maven

[doc_header]

Overview

Learn how to use Maven to create an empty Android project setup with the Androidplot library.  This particular tutorial makes use of Maven on the command line but there's also a video that covers the same topics from the perspective of an IntelliJ user.

Prerequisites

You'll need to have the following installed and configured before proceeding:

Generate a New Project

The quickest way to do this is to use an archetype:
mvn archetype:generate \
  -DarchetypeArtifactId=android-quickstart \
  -DarchetypeGroupId=de.akquinet.android.archetypes \
  -DarchetypeVersion=1.0.9 \
  -DgroupId=your.company \
  -DartifactId=my-android-application

Add Androidplot as a Dependency

Add the following to the <dependencies>  section of pom.xml:
<dependency>
    <groupId>com.androidplot</groupId>
    <artifactId>androidplot-core</artifactId>
    <version>0.6.1</version>
</dependency>
If you'd like to use a SNAPSHOT build then you'll also need to tell Maven where to find the Androidplot snapshots.  Add a <repositories>  section to your pom.xml and insert the following:
<repository>
    <id>sonatype-oss-public</id>
    <url>https://oss.sonatype.org/content/groups/public/</url>
     <releases>
         <enabled>true</enabled>
      </releases>
      <snapshots>
          <enabled>true</enabled>
      </snapshots>
</repository>

Build the Project

This as simple as invoking mvn package  from the command line.  if all went well you should see the following result at the end:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.168s
[INFO] Finished at: Mon Jan 21 19:29:43 CST 2013
[INFO] Final Memory: 16M/81M
[INFO] ------------------------------------------------------------------------