Maven: The Complete Reference
Maven: The Complete Reference

Maven: The Complete Reference
Maven: The Complete Reference

Maven: The Complete Reference
Maven: The Complete Reference

Maven: The Complete Reference
Maven: The Complete Reference

Maven: The Complete Reference
Maven: The Complete Reference

Maven: The Complete Reference
Maven: The Complete Reference

14.4. Maven Android Plugin Details

14.4.1. Maven Android Plugin Lifecycle

The Android Maven plugin customizes the lifecycle based on the packaging. If your project has a packaging of type+apk+ the Android plugin will execute a customized lifecycle.

The customised life cycle has the following additional executions in the default lifecycle.

generate-sources Phase
Use the Android Asset Packaging Tool (aapt) of the platform version specified in the pom to package the Android specific resources like AndroidManifest.xml, assets and resources.
process-classes Phase
Run the dx tool of the platform version specified in the pom to convert all classes (libraries, resources and project code) into davlik executable format.
package Phase
Run the Android Package tool (apk) of the Android SDK to create and sign the Android package file (apk) for installation on the emulator or device.
pre-integration-test Phase
Deploy the currently built Android application package (apk) as well as any other dependencies with packaging type apk to the emulator/device.
integration-test Phase
Run the instrumentation test classes against the deployed application.

14.4.2. Maven Android Plugin Goals

The Maven Android Plugin contains the following goals:
android:apk
The apk goal creates the android package (apk) file. By default the plugin signs the file with the debug keystore. The configuration parameter can be used to disable the signing process.
<sign><debug>false<debug><sign>
android:deploy
The deploy goal deploys the built apk file, or another specified apk, to a connected device or emulator. This goal is automatically performed when running through the integration-test lifecycle phase on a project with instrumentation tests (e.g. mvn install or mvn integration-test).
android:deploy-dependencies
The deploy-dependencies goal deploys all directly declared dependencies of <type>apk</type> in this project. This goal is usually used in a project with instrumentation tests, to deploy the apk to test onto the device before running the deploying and running the instrumentation tests apk. The goal is automatically performed when running through the integration-test life cycle phase on a project with instrumentation tests (e.g. mvn install or mvn integration-test).
android:dex
The dex goal converts compiled Java classes to the Android Dalivk Executable (dex) format.
android:emulator-start
The emulator-start goal starts the Android device emulator. The start up parameters can be configured in the Maven Android Plugin configuration in the pom.xml file
<configuration>
    ...
    <emulator>
        <avd>21</avd>
        <wait>6000</wait>
        <options>-no-skin</options>
    </emulator>
    ...
</configuration>

or via command line parameters outside an actual project.

mvn android:emulator-start \
-Dandroid.emulator.avd=Default \
-Dandroid.emulator.options=-no-skin \
-Dandroid.emulator.wait=10000
android:emulator-stop
The emulator-stops stops the Android device emulator and can be used inside or outside a Maven project folder.
android:generate-sources
The generate-sources goal generates R.java based on the resources specified by the resources configuration parameter. It generates Java files based on aidl files. If the configuration parameter deleteConflictingFiles is true (which it is by default), this goal has also deletes any R.java files found in the source directory, deletes any .java files with the same name as an .aidl file found in the source directory and deletes any Thumbs.db files found in the resource directory.
android:instrument
The instrument goal runs the instrumentation android package on the device/emulator.
android:internal-integration-test
The internal-integration-test goal is called automatically when the lifecycle reaches the integration-test phase. It determines whether to call the goal instrument in this phase based on the existence of instrumentation test classes in the current project. The goal is internal to the plugin lifecycle and should not be used as separate invocation on the command line.
android:internal-pre-integration-test
The internal-pre-integration-test goal is called automatically when the lifecycle reaches pre-integration-test phase. It determines whether to call the goals android:deploy-dependencies and android:deploy in this phase and if necessary invokes them. The goal is internal to the plugin lifecycle and should not be used as separate invocation on the command line.
android:pull
The pull goal can be used to copy files or directories from the device.
android:push
The pull goal can be used to copy files or directories to the device.
android:undeploy
The undeploy goal removes the apk of the current project, or another specified apk, from the connected device.
Sonatype Promotion Subscribe via RSS
Sonatype Promotion Subscribe via RSS