Configuring the Android Maven Plugin for Eclipse - mgrah043/sequence_database_barcode_scanner GitHub Wiki

This page describes the steps required to install and configure the Android Maven plugin for Eclipse.

Step 1 - Installing the Android Maven Plugin

  • Launch the Eclipse ADT
  • From the menu bar, navigate to Help -> Install New Software
  • Enter the following URL into the "Work with" text field: http://rgladwell.github.com/m2e-android/updates/
  • Click the "Select All" button and then click "Next"
  • Follow the remaining on-screen instructions to install the plugin
  • Restart Eclipse

Step 2 - Convert to a Maven Project

Now we must convert the existing SeqDB Barcode Scanner project to a Maven project.

  • In the Package Explorer view, right-click on the top level project folder (seqdb_barcode_scanner), then go to Configurations -> Convert to Maven project.

Step 3 - Creating the Run Configurations

Before we can run the project, we must create custom Maven run commands in Eclipse.

  • From the menu bar, click on Run -> Run Configurations
  • Double-click on the Maven Build option and a new configuration will be created.
  • Select the new configuration and make the following changes in the Main tab: In the Name field enter android clean install For the Base directory field, click Browse Workspace and select the seqdb_barcode_scanner project folder In the Goals field enter clean install Click the Add button next to the Parameter table and enter ANDROID_HOME for the Name and your Android SDK directory (Ex. C:\adt-bundle-windows-x86_64-20130729\sdk) in the Value field.
  • On the JRE tab, make sure you are using a JDK (instead of just the JRE) greater than or equal to 1.6
  • Create another Maven run configuration called android deploy. Apply the same changes as mentioned above except change the Goal to android:deploy android:run

Step 4 - Running the Project

To run the project through Eclipse:

  • Run the "android clean install" Maven command to compile the project
  • Make sure an Android emulator is running or a device is connected
  • Run the "android deploy" command

To run the project through a terminal on Linux:

  • Navigate to the project folder where the pom.xml file is located.
  • To compile the project, run mvn clean install -DANDROID_HOME="/your install directory/adt-bundle-windows-x86_64-20130729/sdk"
  • To deploy the project on an android device, run mvn android:deploy -DANDROID_HOME="/your install directory/adt-bundle-windows-x86_64-20130729/sdk"